I am following the following example from here to use WinRT API's in a Win32 Application.
I added references to System.Runtime
and System.Runtime.InteropServices.WindowsRunTime
but when I add the reference to Windows.winmd
I get the following error:
Error 1 Problem generating manifest. Could not load file or assembly 'C:\\Program Files (x86)\\Windows Kits\\8.1\\References\\CommonConfiguration\\Neutral\\Windows.winmd' or one of its dependencies. Attempt to load a program with an incorrect format.
I tried various configurations using different .NET frameworks and versions of Visual Studio. What can I try?
It seems that the setting
<GenerateManifests>true</GenerateManifests>
in the project file (eg .csproj) is not compatible with winmd references.
This setting is added when enabling the ClickOnce security settings (Project Properties => Security => Enabling ClickOnce security settings checkbox).
So far I could not find a way to fix the concrete problem, but I found a workaround, which works for my case: I just created a separate Class Library project in my solution, which the main project references. In the class library project file I added the line
<TargetPlatformVersion>8.0</TargetPlatformVersion>
as described in the referenced article.
The library project compiles and also the main project can use the dll without problems.
在这个stackoverflow解决方案之后,我解决了一个非常类似的问题,该解决方案基本上使您发布了winmd。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.