APPX0501 编译错误

编译项目总是出现 appxmanifest.xml 生成错误, 发现消除 winmd的cache就可以.

bin\x64\Release\AppxManifest.xml : error APPX0501: 验证错误。error 80080204: App manifest validation error: Line 86, Column 12, Reason: If it is not an audio background task, it is not allowed to have EntryPoint="xxx.xxx" without ActivatableClassId in windows.activatableClass.inProcessServer.

winmd的cache内容不包含需要的InProcServers 信息.

影响的变量是 AppxWinMdCacheEnabled, 没有找到设置的地方.

在项目文件中增加

+  <PropertyGroup>
+    <AppxWinMdCacheEnabled Condition="'$(AppxWinMdCacheEnabled)' == ''">false</AppxWinMdCacheEnabled>
+  </PropertyGroup>

重复编译成功.

一开始的做法是主动删除cache, 结果还需要写判断语句, 不然文件夹不存在就编译失败了.

+  <PropertyGroup>
+    <PreBuildEvent>if exist  $(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\.winmd_cache\*.* (del $(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\.winmd_cache\*.* /Q)</PreBuildEvent>
+  </PropertyGroup>

研究这个有点不务正业.

猜你喜欢

转载自www.cnblogs.com/kennethjia/p/12820086.html
今日推荐