如何自动增加软件包的版本号? [英] How do I auto increment the package version number?
问题描述
我意识到可以通过更改自动增加程序集的内部版本号/修订版
I realize that the build/revision number of the assembly can be auto incremented by changing
[assembly: AssemblyVersion("1.0.0.0")]
到
[assembly: AssemblyVersion("1.0.*")]
AssemblyInfo.cs文件中的
in the AssemblyInfo.cs file.
但是如何自动增加Package.appxmanifest中定义的版本号?也就是说,可以通过以下方式访问版本号:
But how do I auto-increment the version number defined in Package.appxmanifest? That is, the version number accessible through:
Windows.ApplicationModel.Package.Current.Id.Version
我正在使用Visual Studio 2013.
I'm using Visual Studio 2013.
推荐答案
三行解决方案,按日期进行版本控制
我遇到了这个问题,直到经过大量研究后才想出如何在 .csproj
文件中的三行中实现自动版本控制.在这里:
Three line solution, versioning by date
I ran into that issue until I figured out after a lot of research how to achieve automatic versioning in just three line in the .csproj
file. Here it is:
<Target Name="NugetPackAutoVersioning" AfterTargets="Build">
<Exec Command="dotnet pack -p:PackageVersion=$([System.DateTime]::Now.ToString("yyyy.MM.dd.HHmmss")) --no-build --configuration $(Configuration) --output "$(SolutionDir)nuget" />
</Target>
这将以"nuget"格式输出名为 {ProjectName}.{Year}.{Month}.{Day}.{Hour} {Minute} {Second} 的NuGet包.文件夹位于项目根目录下,以确保以后生成的软件包被版本化为后代.
This will output a NuGet package named like {ProjectName}.{Year}.{Month}.{Day}.{Hour}{Minute}{Second}
in a "nuget" folder at the project root, guaranteeing that packages built later are versioned as posteriors.
这篇关于如何自动增加软件包的版本号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!