c# - APPX4001 警告

标签 c# visual-studio uwp

我的 UWP 项目中出现以下警告。我已经标记了解决方案的示例,但我更感兴趣的是为什么在同一平台上创建另一个空项目时不会出现此警告?

APPX4001: Build property AppxBundlePlatforms is not explicitly set and is 
calculated based on currently building architecture. Use 'Create App 
Package' wizard or edit project file to set it.

最佳答案

APPX4001 警告的简单解决方法见 this issue .

But I am more interested in why this warning does not occur when creating another empty project on the same platform?



我搜索了关于这个警告的相关信息,发现了这个 similar issue .见 ...\AppxPackage\Microsoft.AppXPackage.Targets(2459,5): warning ... ,所以似乎这个警告是由 Microsoft.AppXPackage.Targets 抛出的文件。不知道为什么警告有时不显示它来自哪里,但我认为目标文件是 APPX4001.dll 的原因。

我在 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage 中找到了该文件. (对于vs2017企业版)让我们检查一下它抛出警告的内容:

enter image description here

所以很明显,如果 Condition 中的值为真,它会抛出警告 APPX4001。这个问题好像跟AppxBundle有关.所以我创建了一个新的uwp项目并构建它,一切正常。然后我将此行添加到其 xx.csproj 文件中:
<AppxBundle>Always</AppxBundle>

然后出现同样的警告:

enter image description here

所以如果你尝试 build with Appxbundle or set the AppxBundle property in project file 就会出现这个警告而您没有设置 AppxBundlePlatforms 属性。

这就是新的简单项目不会显示此警告的原因。此警告的简单解决方法是设置 AppxBundlePlatforms 属性,请参阅我的答案中的第一行。

希望以上所有内容可以帮助解决为什么会出现警告并解决警告的难题。
如果我误解了什么,请告诉我:)

关于c# - APPX4001 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57643594/

相关文章:

java - 在 Java 中创建动态生成代码的工具(在 Eclipse 中)

c# - 如何使用UWP访问azure表存储?

c# - 从 UWP C# 应用程序使用 pinvoke 调用 LoadLibrary

c# - 如何使用 C# 在 DataGridView 中制作一个唯一的列?

c# - 设置 "Always copy to output directory"时,Content 和 None 有什么区别?

c# - MVC View 是否可以访问所有项目,即使它们未被 View 所在的项目引用?

visual-studio - 在TFS项目中,Visual Studio将WCF类标记为 “Type or namespace could not be found”,但是可以完美地编译和构建它们

datagrid - 隐藏组面板 Telerik DataGrid UWP

c# - 如何在 AngleSharp 中解析来自匿名 block 的文本?

c# - .Net 中的零舍入错误类?