Search code examples
wpfuwpdesktop-bridge

Desktop Bridge UWP Windows.Services.Store;


I have a windows store WPF desktop bridge app compiled to 4.6.1. I am going to give the app away free and allow for in app purchases. To do this I need to use the UWP API for the windows store service.

I am also using the new desktop bridge packaging app template.

I want to keep the UWP API separate from the WPF project, so I have created a serparate dll project for the UWP API. I reference System.Runtime.WindowsRuntime and Windows. Use basic code from the Store Sample.

I add a reference from the WPF app to the UWP dll.

As soon as I reference the UWP dll the desktop bridge packaging app will return 9805 Errors and 1 warning.

One of the errors (which is typical) is

The .winmd file 'Windows.winmd' contains type 'Windows.Gaming.Input.Gamepad'. The use of the Windows namespace is reserved.

The warning is

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

I get the same errors if I add the two references to the WPF directly (System.Runtime.WindowsRuntime and Windows) and remove the UWP dll.

Updated: Have confirmed this is a problem with Desktop Bridge by:

Creating a new WPF App project.
Creating a new Windows Application Packaging Project and configure it to include the WPF project.
Build the WPF project.
Create an appx package and perform WACK tests. All Okay.
Add a reference to the C:\Program Files (x86)\Windows Kits\10\UnionMetadata\winmd
Add a reference to the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
Build the WPF project.
Trying to build the Packaging Project results in 9805 errors.

Here is the blog that I was following: https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/

Anyone know what is going on?

The error messages come from the WACK tests

<TEST INDEX="54" NAME="Type name correctness" DESCRIPTION="Only system types can be in the Windows namespace and no types can be in the global namespace." EXECUTIONTIME="00h:00m:08s.46ms" OPTIONAL="FALSE">
    <MESSAGES>
      <MESSAGE TEXT="The Windows.ApplicationModel.StartupTaskState type in the Windows.winmd file is in the Windows namespace." />
      <MESSAGE TEXT="The Windows.ApplicationModel.PackageSignatureKind type in the Windows.winmd file is in the Windows namespace." />
      <MESSAGE TEXT="The Windows.ApplicationModel.PackageVersion type in the Windows.winmd file is in the Windows namespace." />

Anyone know how to get around it?


Solution

  • Visual Studio update 15.5 includes an update to the desktop bridge packaging project that allows you to include UWP Api's.