Windows.winmd 'file or assembly failed to load

My WPF Desktop application also uses WinRT classes.

For this, I follow this guide https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications .

Ok, that works.

Now when I try to generate the msi file (I tried to use Microsoft Installer and ClickOnce), I get this error:

Error creating manifest. Failed to load file or assembly "C: \ Program Files (x86) \ Windows Kits \ 8.1 \ References \ CommonConfiguration \ Neutral \ Windows.winmd" or one of its dependencies. Try to download the program with the wrong format.

I have already tried disabling ClickOnce, as suggested here , with cleaning up the project and removing ASP.NET from different .NET frameworks.

This is my startup tag in my app.config

I am using VS2015 and C # How can I fix this and generate my msi?

PS: I have no problem generating another msi using a simple WPF desktop.

+8
c # wpf windows-runtime
source share
1 answer

Yes, the Windows.winmd file that you added as a link is an obstacle to project deployment. The tools you use confuse its contents; it looks just like a .NET assembly. But this is not so. The .winmd file format is an extension of the old COM type library format. For WinRT, they used the .NET metadata format to overcome the limitations of the TLB file format.

It was a pretty good idea, many .NET tools can use as-is metadata. Like compilers and disassemblers, they did not need to implement this entire infrastructure. But it strictly plays the role of a reference assembly, only the compiler uses its content and should never be deployed. You donโ€™t really like this good idea right now :)

However, it is very easy to fix ClickOnce deployment. Go to Project> Properties> Publish Tab> Application Files. Change the Publish Status setting for Windows.winmd to Exclude. Screen example:

enter image description here


Itโ€™s not entirely clear what you mean by โ€œMicrosoft Installer,โ€ I assume that you are talking about an installation project. Although it has been removed from Visual Studio due to chronic issues, it is still available in the gallery.

To make the nut more difficult, you usually use the Add> Project Output context menu item to determine its dependencies. This doesn't work anymore, it dies with a miserable error message:

ERROR: An error occurred during validation. HRESULT = '80070057'

The error code means "Invalid parameter", which does not help narrow down the problem. But you can safely assume that it dies when you try to resolve the Windows.winmd link in the .exe assembly.

The workaround is to not let the dependencies be automatically detected, but to choose them yourself. On the editor screen, titled โ€œFile System on Target Computer,โ€ select the application folder. Right-click "Primary Output from ..." and select "Delete."

Right-click the application folder> Add> File and select the .exe project file from the bin \ Release folder. Repeat for other files, you can use the list of files that you got in the list of ClickOnce application files as a guide.

Create a project, now you will receive:

WARNING: Cannot find dependency "WINDOWS" (Signature = '(null)' Version = '255.255.255.255') of the assembly 'WindowsFormsApplication144.exe'

Which is completely benign, we donโ€™t want to find it, the Setup.exe program works fine.

+25
source share

All Articles