Mehrzad Chehraz
Mehrzad Chehraz

Reputation: 5137

Unable to use Windows Application Package when the app references Windows.winmd

I tried to use the new method of creating Appx packages, Windows Application Package project using Visual Studio 2017. The main (WPF) project uses UWP api by referencing Windows.winmd as suggested here.

<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd</HintPath>
</Reference>

The main project compiles fine as before, but when I attempt to create the appx package from the Windows Application Package project, I get a warning and thousands of similar errors as below:

No implementation file was provided for the .winmd file '[ApplicationOutputDirectory]\Windows.winmd'. To generate registration information in the app manifest, specify the 'Implementation' metadata on the .winmd reference item in the project file.

The .winmd file 'Windows.winmd' contains type 'Windows.Storage.IKnownFoldersStatics2'. The use of the Windows namespace is reserved.

The .winmd file 'Windows.winmd' contains type 'Windows.Storage.NameCollisionOption'. The use of the Windows namespace is reserved.

Is there another way to add a reference to UWP in a WPF app to avoid this issue?

Upvotes: 0

Views: 599

Answers (1)

Stefan Wick  MSFT
Stefan Wick MSFT

Reputation: 13850

Make sure you set "Copy Local to false for this reference. You only need it at build time, you won't need the .winmd file packaged up into the .appx package.

Upvotes: 2

Related Questions