private List<Device> getDevices()
{
DatastoreManager dsmgrObj = new DatastoreManager(1033);
Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "Windows Phone 7");
List<Device> alldevices=new List<Device>();
foreach (Device WP7Device in WP7SDK.GetDevices())
{
alldevices.Add(WP7Device);
}
return alldevices;
}
上面代码在x86平台调试正常返回可用设备列表,在x64平台就出错:检索 COM 类工厂中 CLSID 为 {250BEABB-55E8-43BB-AC97-2D95674ECE14} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。
问题是,主程序要设计到64位平台下端口读写,所以必须在x64下调试,也因为如此上述代码无论用什么方法都放不进主程序,我试过做成dll、控件,都不行。问各位高手,有没有解决方法,不可能x64下就读不了设备了吧。
出错语句:
DatastoreManager dsmgrObj = new DatastoreManager(1033);