【发布时间】:2016-02-07 06:54:38
【问题描述】:
我有一个 32 位程序(用 C++ 编写),它可以连接到一些不同的设备,只要它是 32 位的,一切正常。但是,现在我需要将其构建为 64 位程序,但后来我遇到了 Windows Phone 7 的一些问题。
我发现我重建为 64 位的 dll(用 C# 编写)在这一行抛出异常:
MultiTargetingConnectivity connectivity = new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID);
例外是:
An unhandled exception of type 'Microsoft.SmartDevice.Connectivity.DatastoreException' occurred in Microsoft.SmartDevice.Connectivity.dll
Additional information: Retrieving the COM class factory for component with CLSID {349AB2E8-71B6-4069-AD9C-1170849DA64C} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
(例如,如果我尝试运行 this example program,它在 32 位下运行,但在同一行以 64 位抛出异常)
当我在注册表中搜索该 CLSID 时,我找到了“C:\Program Files (x86)\Common Files\Microsoft Shared\Phone Tools\CoreCon\11.0\Bin\ConMan2.dll”的路径,所以我@ 987654322@ 但我仍然遇到同样的异常。
更新:
由于我可能需要创建一个解决方法而不是找到 64 位版本的 ConMan2.dll,如果有人可以向我展示可能的解决方法,我会在此处发布一些我当前的 dll,以便它可以在 32 位和 64 位中工作.
namespace WP7DLL
{
// Interface declaration.
[Guid("11111111-1111-1111-1111-111111111111")]
public interface IWP7DLL
{
int GetStatus();
};
[ClassInterface(ClassInterfaceType.None)]
[Guid("22222222-2222-2222-2222-222222222222")]
public class WP7DLL : IWP7DLL
{
public WP7DLL() { }
public int GetStatus()
{
//Line that gives an exception in 64 bit
MultiTargetingConnectivity connectivity = new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID);
...
...
}
}
}
【问题讨论】:
标签: c# windows windows-phone-7 windows-phone 32bit-64bit