在Windows应用商店中出现typeeloadeexception

本文关键字:typeeloadeexception Windows 应用 | 更新日期: 2023-09-27 18:03:17

我在Windows商店应用程序中使用Winmd (Windows运行时组件)。当我尝试实例化在Winmd中定义的类型时,我得到以下异常:

 System.TypeLoadException was unhandled by user code
  HResult=-2146233054
  Message=Requested Windows Runtime type 'SmartTech.BrokeredProxy.EnterpriseServer' is not   registered.
  Source=mscorlib
  TypeName=SmartTech.BrokeredProxy.EnterpriseServer
    InnerException: System.Runtime.InteropServices.COMException
       HResult=-2147221164
       Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
       ErrorCode=-2147221164
       InnerException: 

我添加了我需要的所有引用,并在Manifest文件中进行了适当的更改。我错过什么了吗?有人知道这是什么原因吗?

在Windows应用商店中出现typeeloadeexception

对于非winrt应用程序,我知道这个错误通常指向未注册的组件。即 regsvr32 "path of the component"

但是对于win 8应用程序,不确定它是否完全适用。

另一种情况,我遇到了类似的问题是由于32位/任何cpu冲突。

组件可能是32位组件,Visual Studio可能正在编译'Any CPU'设置。尝试将"目标CPU"从项目属性更改为x86,看看问题是否发生。

Project -> Properties -> Build tab -> Platform Target -> Any CPU to x86

相关文章:
  • 没有找到相关文章