Search code examples
msbuilduwppackageversionvnext

Change appx package version from vNext build


I've created a UWP project that I'm building with a TFS vNext build. When it creates the package, it uses the version from the appx manifest. Instead, I'd like to set the version number from the msbuild command line. Is this possible?


Solution

  • I ended up doing the same thing @Dave Smits:

    (1) Copied the contents of Package.appxmanifest to a new file called Package.appxmanifest.template, and added it to the project.

    (2) Kept the Package.appxmanifest file in the solution, but excluded it from source control.

    (3) Created a powershell script and added it to source control (see below).

    (4) Execute this powershell script at build time. For me, this meant adding a PowerShell step prior to building the solution.

    param([io.fileinfo]$template, [io.fileinfo]$package, [string]$version)
    [xml]$xml = gc $template
    $xml.Package.Identity.Version = $version; 
    $xml.Save($package)