Windows 10 UWP AppService,package.appxmanifest问题

时间:2017-07-18 17:56:49

标签: c# uwp windows-10 appxmanifest

我正在尝试在此微软文章https://docs.microsoft.com/en-us/windows/uwp/launch-resume/how-to-create-and-consume-an-app-service

之后在UWP中创建一个简单的ServiceApp

但是,本文建议的清单更改导致我的服务应用程序无法构建。

enter image description here

我花了几天的时间在Microsoft文档中搜索“http://schemas.microsoft.com/appx/manifest/uap/windows10/4”,“uap4”和“SupportsMultipleInstances”这样的术语,但是没有任何运气可以确定构建失败的原因。我已经在MSDN上发布了很多关于详细信息的问题,但这变成了浪费时间,因此,和MS一样。

我的Windows 10版本是1703,Windows 10 Enterprise,OS Build 15063.413

Visual Studio 2015 Enterprise,版本14.0.25431.01更新3

以下是我得到的错误

Validation error. error C00CE015: App manifest validation error: 
The app manifest must be valid as per schema: 
Line 31, Column 58, Note: 
The schema for OSMinVersion specified does not recognize XML fields with namespace "http://schemas.microsoft.com/appx/manifest/uap/windows10/4". 
Please ensure that you have the correct OSMinVersion specified. Reason: The attribute '{http://schemas.microsoft.com/appx/manifest/uap/windows10/4}SupportsMultipleInstances' on the element '{http://schemas.microsoft.com/appx/manifest/uap/windows10}AppService' is not defined in the DTD/Schema.   
AppServiceProviderInSeparateBackgroundProcess   C:\Users\myuid\Desktop\work\AppServiceProviderInSeparateBackgroundProcess\AppServiceProviderInSeparateBackgroundProcess\bin\x86\Debug\AppxManifest.xml  

以下是由Blank App(通用Windows)创建的完整Package.appmanifest,其中添加了命名空间和Extensions标签,如文章所述

<?xml version="1.0" encoding="utf-8"?>

<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
  xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
  IgnorableNamespaces="uap mp">

  <Identity
    Name="8db1ab9e-1dff-4fd4-a450-77fadd221043"
    Publisher="CN=username"
    Version="1.0.0.0" />

  <mp:PhoneIdentity PhoneProductId="8db1ab9e-1dff-4fd4-a450-77fadd221043" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

  <Properties>
    <DisplayName>AppServiceProviderInSeparateBackgroundProcess</DisplayName>
    <PublisherDisplayName>username</PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
  </Dependencies>

  <Resources>
    <Resource Language="x-generate"/>
  </Resources>

  <Applications>
    <Application Id="App"
      Executable="$targetnametoken$.exe"
      EntryPoint="AppServiceProviderInSeparateBackgroundProcess.App">
      <!-- Added Appservice extension that advertises com.Microsoft.Inventory service
           This identifies this app as an app service provider.  The service wil be
           implemented as a background task.
           The app service app exposes the service to other apps.-->
      <Extensions>
        <uap:Extension Category="windows.appService" EntryPoint="MyAppService.Inventory">
          <uap:AppService Name="com.microsoft.inventory" uap4:SupportsMultipleInstances="true"/>
        </uap:Extension>
      </Extensions>
      <uap:VisualElements
        DisplayName="AppServiceProviderInSeparateBackgroundProcess"
        Square150x150Logo="Assets\Square150x150Logo.png"
        Square44x44Logo="Assets\Square44x44Logo.png"
        Description="AppServiceProviderInSeparateBackgroundProcess"
        BackgroundColor="transparent">
        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
        <uap:SplashScreen Image="Assets\SplashScreen.png" />
      </uap:VisualElements>
    </Application>
  </Applications>

  <Capabilities>
    <Capability Name="internetClient" />
  </Capabilities>
</Package>

UWP截图的版本如下 enter image description here

enter image description here

Windows 10 SDK enter image description here

1 个答案:

答案 0 :(得分:3)

问题是您需要使用Visual Studio 2017并使用build 15063或更高版本来使用uap4 - namespaced属性。