Ever notice some MSIX project source trees have a Package.appxmanifest file instead of AppxManifest.xml and wonder: Why, and how do they differ?
Package.appxmanifest vs. AppxManifest.xml: What’s the difference?
Package.appxmanifest is a templated variant of AppxManifest.xml.
Visual Studio packaging projects introduced the convention of Package.appxmanifest as a template, using placeholder tokens such as $targetnametoken$ and $targetentrypoint$. Packaging projects would read this file during their build, replace the placeholder tokens with appropriate values, and save the result in the build’s output directory1 as AppxManifest.xml. The generated AppxManifest.xml is the file ultimately consumed by the packaging toolchain.
For example, a Package.appxmanifest containing
...
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
...
could become an AppxManifest.xml with
...
<Application Id="App"
Executable="PointOfSale.exe"
EntryPoint="Contoso.PointOfSale.CardReader">
...
Package.appxmanifest is an AppxManifest.xml file, except some values have been replaced with template placeholders (and the filename differs).
That’s why you can edit Package.appxmanifest exactly as you would AppxManifest.xml. This is handy when Visual Studio doesn’t provide interactive UI or project properties to add or set manifest content for you. For example, there’s no VS feature to make a Framework package, but you can create one by directly editing Package.appxmanifest to add <Framework>true</Framework>
<Package...>
...
<Properties>
<Framework>true</Framework>
...
Visual Studio may not know how to add the <Framework> element to Package.appxmanifest, but it respects and preserves your edits.
This isn’t terribly surprising because the transformation from Package.appxmanifest to AppxManifest.xml is fundamentally a string-substitution process.
Transform without Visual Studio
You can perform the same transformation yourself with a small script or program, provided you have the necessary input data.
For example, let’s write a script file SetVersion.ps1 to set the package’s version per the version in a file’s VERSIONINFO:
param(
[string]$From="Package.appxmanifest",
[string]$To="AppxManifest.xml",
[Parameter(Mandatory=$true)][string]$Exe
)
Set-StrictMode -Version 3.0
$ErrorActionPreference = "Stop"
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($exe).FileVersion
$manifest = [IO.File]::ReadAllText($From)
$manifest = "$manifest" -replace "#version#", "$version"
[IO.File]::WriteAllText($To, $manifest)
Now given a Package.appxmanifest file containing
<Package...>
..
<Identity...Version="#version#".../>
...
</Package>
and PointOfSale.exe containing version 2026.11.22.0 in its VERSIONINFO, we can run the command
pwsh.exe -File .\SetVersion.ps1 -NoProfile -NonInteractive -Exe C:\Contoso\bin\Release\x64\PointOfSale.exe
and voila! AppxManifest.xml has the matching version:
<Package...>
..
<Identity...Version="2026.11.22.0".../>
...
</Package>
Visual Studio initially created Package.appxmanifest, but the notion of a templated file transformed by a build process to the final product is as old as dirt. Modern MSIX projects typically perform the transformation through build targets, but the underlying idea remains the same: start with a template manifest, substitute build-specific values, and produce the final AppxManifest.xml.
1 For example, $(OutDir)\AppxManifest.xml
0 comments
Be the first to start the discussion.