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

asked 2020-05-08T01:30:45.3+00:00
teknofunk 21 Reputation points

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: https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/ 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?

Universal Windows Platform (UWP)
{count} votes