Desktop Bridge UWP Windows.Services.Store;

时间:2017-11-14 00:36:19

标签: wpf uwp desktop-bridge

我有一个Windows商店WPF桌面桥应用程序编译为4.6.1。我将免费提供应用程序,并允许在应用程序购买。为此,我需要将UWP API用于Windows应用商店服务。

我也在使用新的桌面网桥打包应用模板。

我想将UWP API与WPF项目分开,因此我为UWP API创建了一个serparate dll项目。我引用System.Runtime.WindowsRuntime和Windows。使用Store Sample中的基本代码。

我将WPF应用程序的引用添加到UWP dll。

一旦我引用UWP dll,桌面桥接打包应用程序将返回9805个错误和1个警告。

其中一个错误(典型的)是

  

.winmd文件' Windows.winmd'包含类型' Windows.Gaming.Input.Gamepad'。保留使用Windows命名空间。

警告是

  

没有为.winmd文件提供实施文件' OUTPUT DIRECTORY PATH \ Windows.winmd'。要在应用清单中生成注册信息,请指定'实施'项目文件中.winmd参考项的元数据。

如果我直接向WPF添加两个引用(System.Runtime.WindowsRuntime和Windows)并删除UWP dll,我会得到相同的错误。

更新:已通过以下方式确认这是Desktop Bridge的问题:

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.

以下是我关注的博客:https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/

任何人都知道发生了什么事?

错误消息来自WACK测试

<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." />

任何人都知道如何绕过它?

4 个答案:

答案 0 :(得分:0)

几天前安装了Visual Studio更新。

我构建了一个新的wpf app项目,目标是4.6.1 添加一个新的Windows打包项目并进行配置。 我不再得到一长串错误,而且引用似乎也有效。两个应用程序都编译。

所以我不确定之前出现了什么问题,或者为什么要修复它。

答案 1 :(得分:0)

在桌面网桥应用程序中使用Windows.Services.Store命名空间与Windows应用程序打包项目不兼容。在构建打包项目时,它将执行WACK测试,这将导致9805错误并停止创建appx包。

如果执行WACK测试,手动创建程序包仍会出现9805错误。但至少你应该有一个可以提交给商店的appx。

答案 2 :(得分:0)

Visual Studio更新15.5包含对桌面桥接打包项目的更新,允许您包含UWP Api。

答案 3 :(得分:0)

输出包中不需要Windows.winmd,我建议将引用属性更改为CopyLocal = false。