Windows Runtime activatable class in Windows 10
Windows Runtime activatable class in Windows 10
当我尝试为WinRT注册一个可激活的类时,我得到了一个错误。这是在Visual Studio 2015中的c#通用应用程序(UAP)中,在Windows 10上。
以前,您可以在包中注册可激活的类。Appxmanifest文件如下:
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>myCode.dll</Path>
<ActivatableClass ActivatableClassId="myNS.MyNativeClass" ThreadingModel="both" />
</InProcessServer>
</Extension>
但是Visual Studio不喜欢这样。它违反了UAP项目的appxmanifest文件的模式:
Validation error. error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 42, Column 20, Reason: 'windows.activatableClass.inProcessServer' violates enumeration constraint of 'windows.backgroundTasks windows.preInstalledConfigTask windows.updateTask windows.restrictedLaunch'. The attribute 'Category' with value 'windows.activatableClass.inProcessServer' failed to parse. TextSecure C:Users123DocumentsGitHubVisualStudioMyProjMyProjbinx86DebugAppxManifest.xml
那么如何从UAP项目中使用Windows Runtime组件呢?如果不注册它,就会得到typeloadeexception。
您把Extensions元素放在了Application元素还是Package元素的什么地方?如果将其放在Application元素中,则会出现此错误。你应该把in放到Package元素中。
例如:<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>yourdll.dll</Path>
</InProcessServer>
</Extension>
</Extensions>
</Package>
相关文章:
- std::async from std::async in windows xp
- 如何在 google test in windows 中管理断言
- 在Windows Visual Studio中实现<netinet/in.h>
- C++ - 程序接收信号SIGSEGV,分段错误.In msvcrt!memcpy () (C:\Windows\S
- 使用 new in C++(在 Windows 上)分配大于 2GB 的单个对象
- pthread_cond_timedwait() in Windows
- TLS with http_listener in Microsoft cpprestsdk on Windows
- Windows 10 环境中的"This version of XAudio2 is available only in Windows 8"错误
- QT c++ "Windows.h no such a file or dictionary in main.ccp"
- QB,如何在Windows上配置.h.in文件
- No FileIO in Windows Phone?
- 包含 Windows.h 和 wingdi.h 时出现"GradientFill was not declared in this scope"错误
- COM in the non-Windows world?
- OLEUnInitialize() in windows 7
- Sleep() in Windows 消息循环
- 未解析的包含:<stdio.h> in Eclipse helios(Windows 7 64bit)
- Performance Windows Socket in C++ with Matlab
- Cython in Windows 64 with GSL
- Handling Multiple windows in Symbian using Qt
- 如何可靠地检测 Mac OS X、iOS、Linux、Windows in C 预处理器