0

I am using an Azure Pipeline that runs automatically when I make a commit to my GitHub repository. The .yml file generates a .msixupload file (for UWP) for upload to the Microsoft Store. However, I cannot upload the generated .msixupload file, as the version number in the .appxmanifest file never changes, and I am attempting to build an update for an existing app. How can I increment the version number each time the Azure Pipeline is run?

I have tried adding

<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>

to the .appxmanifest file as described here: How do I auto increment the package version number?, but that has not made any difference.

1 Answers1

1

You can use powershell scripts to change the version value in appxmanifest file. See below example:

In your yaml pipeline. You can set variables like below: See here for more information about counter expression.

variables:
  major: 1
  minor: 0
  build: $(Build.BuildId)
  version:  $[counter(variables['major'], 0)]  

Then add powershell task to run below script to update the version value:

  - powershell: |
       [Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq")
       $path = "Msix/Package.appxmanifest"
       $doc = [System.Xml.Linq.XDocument]::Load($path)
       $xName =
         [System.Xml.Linq.XName]
           "{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity"
       $doc.Root.Element($xName).Attribute("Version").Value =
         "$(major).$(minor).$(build).$(revision)";
       $doc.Save($path)
      displayName: 'Version Package Manifest'

Please check this document for more information.

Since appxmanifest file is just text-based XML file. You can also use Extension tool Magic Chunks task to change version value in appxmanifest file . Check this thread for example.

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • This does not appear to be effective. After implementing the Assembly Info task, the generated .msixupload file's name still reflects the version number in the app manifest, which has not changed. Upon attempting to upload the .msixupload file to the Microsoft Store, the following error is displayed: "You have provided two packages with the full name which have different contents. Please remove one of these packages, or increment current package versions to continue." Just changing the file name also doesn't do the trick. – user2052677 Jan 20 '21 at 08:42
  • 1
    @user2052677 You can write powershell script to change the version value or use extension replace task(Magic Chunks). I updated above answer. – Levi Lu-MSFT Jan 20 '21 at 09:32