共用方式為


Windows Store app projects stopped generating the .appxupload file after installing VS 2015 Update 1

Problem

A few people have noticed that their Windows Store app projects stopped generating the .appxupload file after upgrading to VisualStudio 2015 Update 1.

 

Cause
The project is not associated with the Store app.
The StoreAssociation file path is missing from the respective project .csproj file.

Either one of these causes listed above can stop the appxupload file from being generated. This is because msbuild tries to find the Package.StoreAssociation.xml file in the project using the path specified in the respective project .csproj file.

Extract from MSBuild log showing working and failing scenarios:

  • Failing scenario:

Notice that (<'@(StoreAssociationFile)'> != '') was evaluated as ('' != ''). Which means the StoreAssociation file was never found.

Task "Warning" skipped, due to false condition; (('$(_ExtractPlatforms)' == 'true' and <'@(StoreAssociationFile)'> == '' and '$(AppxBundlePlatforms)' == '')
                         or ('$(_ExtractPlatforms)' == 'true' and <'@(StoreAssociationFile)'> != '' and '$(_Platforms)' == '')) was evaluated as (('false' == 'true' and '' == '' and 'x86|arm' == '')
                         or ('false' == 'true' and '' != '' and '' == '')).

 

  • Working scenario: 

Notice that (<'@(StoreAssociationFile)'> != '') was evaluated as ('Package.StoreAssociation.xml' != ''). Which means the StoreAssociation file was found and evaluated correctly.

Task "Warning" skipped, due to false condition; (('$(_ExtractPlatforms)' == 'true' and <'@(StoreAssociationFile)'> == '' and '$(AppxBundlePlatforms)' == '')
                         or ('$(_ExtractPlatforms)' == 'true' and <'@(StoreAssociationFile)'> != '' and '$(_Platforms)' == '')) was evaluated as (('false' == 'true' and 'Package.StoreAssociation.xml' == '' and 'x86|arm' == '')
                         or ('false' == 'true' and 'Package.StoreAssociation.xml' != '' and '' == '')).

 

Solution

To successfully generate the .appxupload file we require the following:

  • The project must be associated with the Store app (Project > Associate with Store…) or use packaging wizard, and select ‘Yes’ when asked to associate the app with the store.
  • Verify that the store association file is present in your project. The file needs to be present on disk and must be referenced in the appropriate .csproj; that’s where we get the file path.
  • The content type of the file must be set to “None” and should look like this in the .csproj file:

          <ItemGroup>
                <None Include="Package.StoreAssociation.xml" />

          </ItemGroup>

  • The xml above is for verification purposes. You shouldn't need to enter these values manually since it gets added automatically when you associate the app with the store.
  • If using a build script, we recommend that you replace the flags “AppxPackageIsForStore” and “BuildAppxUploadPackageForUap” with the new flag “UapAppxPackageBuildMode=StoreUpload”
    • The BuildMode flag will set the other required flags and invoke the right validations (including checking for store association) to produce a .appxupload package.