TFS 中的 Net Core 产品版本号
Net core product version number in TFS
我不是部署方面的专家,所以向大家询问一件我在互联网上找不到的事情。
假设我有一个用.net core 编写的项目,最好是aspnet core。
我也在使用 TFS (VSTS)。
理想情况下,我需要在我的软件版本中包含一个内部版本号(或版本号,我不知道如何更精确),我可以在 'About Us' 页面上看到它。我想理想情况下,它应该是当前代码版本的签入号。但我想这可能是存在任何其他好的解决方案。
需要建议。
最简单的方法是使用内部版本号作为版本号。有一个全局 .NET 版本控制策略:AssemblyInformationalVersion。您可以使用此策略为您的软件添加版本控制。您可以使用 powershell script 对程序集进行版本控制。
The powershell script will do the magic in the background to replace
all versioning values for AssemblyVersion, AssemblyFileVersion and
AssemblyInformationalVersion in the Assembly Info files, based on this product version. The product version will be passed as a whole to
the AssemblyVersion and the AssemblyInformationalVersion attributes.
The AssemblyFileVersion will be replaced with a full version number
which will consist of the major and minor version number of the
product version, a Julian based date and an incremental build number.
For the meaning of Assembly File Version = 2.7.15169.03
- 2 => taken from “Major” product version
- 7 => taken from “Minor” product version
- 15169 => generated by build process: “15” = year 2015, “169” = day of year 2015
- 3 => third build, run on day 169 in year 2015
有关更多详细信息,您可以查看这个很棒的 post:TFS Build 2015 … and versioning! and this similar topic vNext Build Awesomeness – Managing Version Numbers
更新
您可以在内部版本号格式中使用 $(Build.SourceVersion)
来包含变更集信息,例如
$(BuildDefinitionName)_$(date:yyyyMMdd)_$(Build.BuildId).$(Build.SourceVersion)$(rev:.r)
然而,此 $(Build.SourceVersion) 仅在提交时自动触发构建(持续集成)时才有效。因为当您 运行 手动构建时,您必须在中输入源版本字段让它填充。更多详情请查看:Build.SourceVersion is blank in VSO vNext Build
您还可以使用 PowerShell 脚本获取源版本变更集编号并将其应用到您的内部版本号或 AssemblyInfo 中。
我不是部署方面的专家,所以向大家询问一件我在互联网上找不到的事情。
假设我有一个用.net core 编写的项目,最好是aspnet core。 我也在使用 TFS (VSTS)。
理想情况下,我需要在我的软件版本中包含一个内部版本号(或版本号,我不知道如何更精确),我可以在 'About Us' 页面上看到它。我想理想情况下,它应该是当前代码版本的签入号。但我想这可能是存在任何其他好的解决方案。
需要建议。
最简单的方法是使用内部版本号作为版本号。有一个全局 .NET 版本控制策略:AssemblyInformationalVersion。您可以使用此策略为您的软件添加版本控制。您可以使用 powershell script 对程序集进行版本控制。
The powershell script will do the magic in the background to replace all versioning values for AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion in the Assembly Info files, based on this product version. The product version will be passed as a whole to the AssemblyVersion and the AssemblyInformationalVersion attributes. The AssemblyFileVersion will be replaced with a full version number which will consist of the major and minor version number of the product version, a Julian based date and an incremental build number.
For the meaning of Assembly File Version = 2.7.15169.03
- 2 => taken from “Major” product version
- 7 => taken from “Minor” product version
- 15169 => generated by build process: “15” = year 2015, “169” = day of year 2015
- 3 => third build, run on day 169 in year 2015
有关更多详细信息,您可以查看这个很棒的 post:TFS Build 2015 … and versioning! and this similar topic vNext Build Awesomeness – Managing Version Numbers
更新
您可以在内部版本号格式中使用 $(Build.SourceVersion)
来包含变更集信息,例如
$(BuildDefinitionName)_$(date:yyyyMMdd)_$(Build.BuildId).$(Build.SourceVersion)$(rev:.r)
然而,此 $(Build.SourceVersion) 仅在提交时自动触发构建(持续集成)时才有效。因为当您 运行 手动构建时,您必须在中输入源版本字段让它填充。更多详情请查看:Build.SourceVersion is blank in VSO vNext Build
您还可以使用 PowerShell 脚本获取源版本变更集编号并将其应用到您的内部版本号或 AssemblyInfo 中。