我现在正在努力解决这个错误几个小时。我可以毫无问题地构建和部署应用程序,它不会创建可分发的包(Project> Store> Create App Packages)
这个问题很奇怪。这是我的Package.appxmanifest文件:
<?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" IgnorableNamespaces="uap mp uap3">
<Identity Name="481f1dca-fa19-4642-8e95-9208a4c9265f" Publisher="CN=mrrey" Version="1.1.8.0" />
<mp:PhoneIdentity PhoneProductId="06509575-8d8e-4beb-aa84-4ea390365781" PhonePublisherId="06509575-8d8e-4beb-aa84-4ea390365785" />
<Properties>
<DisplayName>XYZ MusicBox</DisplayName>
<PublisherDisplayName>mrrey</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="XYZ_MusicBox.App">
<uap:VisualElements DisplayName="XYZ MusicBox" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="XYZ MusicBox" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap:Capability Name="musicLibrary" />
<uap3:Capability Name="backgroundMediaPlayback" />
<DeviceCapability Name="microphone" />
</Capabilities>
</Package>
这是我的清单的初始状态。单击向导中的Create
后,它开始构建软件包。输出:
...
1> 1018 ms Csc 2 calls
1> 1091 ms ResolveAssemblyReference 1 calls
1> 3498 ms CompileXaml 2 calls
1> 3615 ms GenerateAppxManifest 1 calls
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:11.30
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Package: 0 succeeded, 1 failed ===========
========== App Bundle: 0 succeeded, 1 failed ===========
之后,当我尝试打开Package.appxmanifest
文件时,由于编译器错误,设计人员不想加载:
Severity Code Description Project File Line Suppression State
Error Validation error. error C00CE014: App manifest validation error: The app manifest must be valid as per schema: Line 34, Column 6, Reason: Element 'Capability' is unexpected according to content model of parent element '{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Capabilities'. Expecting: {http://schemas.microsoft.com/appx/manifest/foundation/windows10}CapabilityChoice, {http://schemas.microsoft.com/appx/manifest/foundation/windows10}DeviceCapability. XYZ MusicBox C:\Users\mrrey\Box Sync\XYZ MusicBox\XYZ MusicBox\bin\x86\Debug\AppxManifest.xml
最奇怪的是,在创建包时,VS正在修改我的原始appxmanifest
文件,并将此行添加到功能中:
<Capability Name="backgroundMediaPlayback" xmlns="" />
正如您在上面的代码中所看到的,我已经添加了此功能,但它需要uap3:
命名空间才能正常工作。但是出于某种原因,它仍然会迫使这一个。那个带有空值的xmlns属性是什么?
在尝试创建包之后,我也收到了许多类似警告的警告:
Severity Code Description Project File Line Suppression State
Warning Imported schema for namespace 'http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/3' was not resolved. XYZ MusicBox C:\Users\mrrey\Box Sync\XYZ MusicBox\XYZ MusicBox\Package.appxmanifest 17
当我删除原始Background Media Playback
功能时,一切正常,但这不是我能承受的,因为它是一个媒体播放器应用程序。这个功能/项目的配置显然有问题,但我找不到它。
当我构建解决方案并将应用部署到Local Machine
/ Device
/仿真器时,就不会发生这种情况。
我使用的是最新的Visual Studio 2017和Windows 10(版本10.0.14393 Build 14393)。
有没有人遇到过类似的问题?我做错了什么还是错误?
谢谢!
编辑:为了使事情变得更加清晰:这些简短的警告(名称空间的导入架构......)指的是<Applications>
,<Application>
,<Properties>
和<Dependencies>
标签
Edit2:I don't even wanna think about this anymore.不知怎的,我打破了它。