Search code examples
uwpmsbuildwindows-10-universalappveyor

How do I skip the packaging step when building a Windows Store app using MSBuild?


I am currently trying to set up continuous integration for my Windows Store application using AppVeyor. The problem I am facing is that the build fails because the Package.StoreAssociation.xml file is missing. This is the detailed error message (error APPX0002):

(_ValidateAppxPackage target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2625,5): error APPX0002: Task 'ValidateAppxPackage' failed. Could not find file 'C:\projects\...\<PROJECTNAME>\Package.StoreAssociation.xml'. [C:\projects\...\<PROJECTNAME>\<PROJECTNAME>.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(2625,5): error APPX0002:  [C:\projects\...\<PROJECTNAME>\<PROJECTNAME>.csproj]

During my research I found this site, which says that this error occurs because of the step which creates the app packages and that it's skipped when using Visual Studio, which I can approve because it works on machines that don't have the Package.StoreAssociation.xml file.

Is there any way to skip this step when using MSBuild, respectively AppVeyor?


So I've found this site which suggested to set the parameter AppxPackageSigningEnabled to false. Unfortunately, that did not help. The command I'm currently using is the following:

msbuild "C:\projects\...\<PROJECTNAME>.sln" /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /p:AppxPackageSigningEnabled=false /p:AppxBundle=Never /verbosity:normal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

Solution

  • The solution to the problem is actually quite simple yet it took me several hours to figure it out, which doesn't make me proud. Now I would like to share my solution:

    msbuild /t:Build /p:Configuration=Release /p:Platform=x86 /p:AppxPackage=false /verbosity:minimal
    

    Using this command the build works just fine. The important parameter here is /p:AppxPackage=false, which will skip the creation of the AppxPackage. This is exactly what I wanted since signing would not work because the StoreKey.pfx file is missing and I cannot provide the key because the application itself is open-source.