您应该.appxmanifest
在创建包之前修改构建管道中的文件。毕竟,它只是一个基于文本的 XML 文件。
如果您使用的是 Azure Pipelines,则可以使用 Powershell 任务和每次构建递增的计数器变量来完成此操作:
pool:
vmImage: vs2017-win2016
variables:
buildPlatform: 'x86'
buildConfiguration: 'release'
major: 1
minor: 0
build: 0
revision: $[counter('rev', 0)]
steps:
- 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'
+Build, Package and Sign.
请参阅此 MSDN 杂志文章以获取更多信息以及有关如何使用 Azure Pipelines 设置持续集成 (CI)、持续部署 (CD) 和自动更新旁加载 MSIX 打包 WPF 应用程序的完整示例。