teknofunk-8598 avatar image
0 Votes"
teknofunk-8598 asked FayWang-MSFT commented

VS 2019 - Windows Application Packaging Project: Could not copy the file “…\WinMetadata\Windows.winmd” because it was not found

I have an existing solution for a UWP Windows Store app, and I recently needed to add Win32 desktop app capabilities to it. I reviewed the Microsoft documentation for adding a full trust executable and followed the example here: After adding the Windows Application Packaging Project and adding my UWP app project as the entry point, I get this error while building:

 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4643,5): error MSB3030: Could not copy the file "C:\path\to\UWP\project\bin\x86\Debug\WinMetadata\Windows.winmd" because it was not found.

I notice that WinMetadata\Windows.winmd is normally included in the AppX folder when packaging the UWP app by itself, but it usually does not appear in the base bin\x86\Debug folder. If I remove almost all of the C# code referenced in my project, I am able to build and run the app. Why would the Windows Application Packaging project be looking for this file in <UWP_Project>\bin\x86\Debug?

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please tell me the detailed steps about how to reproduce this issue in your side?

0 Votes 0 ·

If I create a new blank UWP project and add that to the WAP project I can confirm it builds fine. But if I then add in the other dependencies, nugets, and project references containing my UWP app's code, I get the behavior I described.

Most of the app's C# code is contained in shared projects (for portability). These shared projects only contain C# code. If I do the above steps, reproduce the error (missing WinMetadata\Windows.winmd) and then remove these shared project references containing the code (leaving all Nugets and other dependencies), it builds again! Obviously I need the code as part of the app.
I assume this file is added by default for UWP apps, so is there a particular thing I should be looking for, maybe in the build log, to see why this file would not be copied into that location?

0 Votes 0 ·

It seems to be caused when you add shared project references, can you provide a simple sample that can be reproduced for us to test?

0 Votes 0 ·

Hi, have you solved your issue? If not, can you provide a simple sample that can be reproduced for us to test?

0 Votes 0 ·

0 Answers