Friday, October 23, 2015

AppXBundlePlatforms and Windows UWP app

Recently I've been working on porting one of my older Windows 8 apps to Windows 10 (Universal Windows Platform), and after associating the Windows 10 app with the Store, I started get the following compiler errors:


  • You cannot create an app bundle containing more than one package per architecture. Value of AppxBundlePlatforms property is 'neutral|neutral'.
  • You cannot create an app bundle which contains a neutral architecture package along with packages for other architectures. Value of AppxBundlePlatforms property is 'neutral|neutral'. 


If I did a Build/Clean Solution and then a Rebuild, the project was happy again, UNTIL I made another change.

Looking a bit closer, I noticed a Compiler Warning as well:


  • 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
Now this warning is actually _helpful_ ! Unfortunately, I tend to not look at Compiler Warnings as carefully as I should. But, in this case I packaged the app up, and noticed that the package process added the following to my .csproj:

  • <AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
... and all was happy again.

On a related note, the change from "neutral" to "x86|x64|arm" is because UWP apps are compiled to Native code when you choose a Release build. This promises 60% faster startup and 15-20% less memory use!