获取 Visual Studio 变更集作为修订的一部分
Get Visual Studio changeset as part of the revision
多年来我一直在使用 Subversion。我发布的软件版本号采用 X.X.X.{SVN REV} 格式,我在 Visual studio 中使用预构建事件来填充 c# 修订文件:
namespace Revision
{
internal static class Svnstrings
{
static public int WCREV = 1959;
static public string WCDATE = "2017/12/08 21:48:52";
static public string WCNOW = "2017/12/28 14:01:35";
static public string WCRANGE = "1949:1959";
static public string WCMIXED = "Mixed update revision";
static public string WCMODS = "Modified";
static public string WCURL = "https://app.deveo.com/SrcCtrl/projects/myProject/repositories/subversion/myProject/trunk/mySource/myProject/Revision";
static public string WCINSVN = "Versioned";
static public string WCNEEDSLOCK = "Lock not required";
static public string WCISLOCKED = "Not Locked";
static public string WCLOCKDATE = "1970/01/01 00:00:00";
static public string WCLOCKOWNER = "";
static public string WCLOCKCOMMENT = "";
}
}
我最近为我的源代码控制切换到 Visual Studio TFS,我想做类似的事情,获取 WCREV 中的变更集值。
也许这太复杂了,但在使用 Subversion 10 多年之后仍在学习新的源代码管理,并且仍在学习基础知识,也许有人有更好的主意。
与 SVN 不同,我们没有 WCREV.exe
随 TFS 安装。
在 TFS 中,最简单的方法是使用内部版本号作为版本号。有一个全局 .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
至于你想 get/set 程序集信息中的变更集编号。
您可以在内部版本号格式中使用 $(Build.SourceVersion)
来实现此目的,例如
$(BuildDefinitionName)_$(date:yyyyMMdd)_$(Build.BuildId).$(Build.SourceVersion)$(rev:.r)
然而,此 $(Build.SourceVersion) 仅在提交时自动触发构建(持续集成)时才有效。因为当您 运行 手动构建时,您必须在中输入源版本字段让它填充。更多详情请查看:Build.SourceVersion is blank in VSO vNext Build
您还可以使用 PowerShell 脚本获取源版本变更集编号并将其应用到您的内部版本号或 AssemblyInfo 中。
多年来我一直在使用 Subversion。我发布的软件版本号采用 X.X.X.{SVN REV} 格式,我在 Visual studio 中使用预构建事件来填充 c# 修订文件:
namespace Revision
{
internal static class Svnstrings
{
static public int WCREV = 1959;
static public string WCDATE = "2017/12/08 21:48:52";
static public string WCNOW = "2017/12/28 14:01:35";
static public string WCRANGE = "1949:1959";
static public string WCMIXED = "Mixed update revision";
static public string WCMODS = "Modified";
static public string WCURL = "https://app.deveo.com/SrcCtrl/projects/myProject/repositories/subversion/myProject/trunk/mySource/myProject/Revision";
static public string WCINSVN = "Versioned";
static public string WCNEEDSLOCK = "Lock not required";
static public string WCISLOCKED = "Not Locked";
static public string WCLOCKDATE = "1970/01/01 00:00:00";
static public string WCLOCKOWNER = "";
static public string WCLOCKCOMMENT = "";
}
}
我最近为我的源代码控制切换到 Visual Studio TFS,我想做类似的事情,获取 WCREV 中的变更集值。
也许这太复杂了,但在使用 Subversion 10 多年之后仍在学习新的源代码管理,并且仍在学习基础知识,也许有人有更好的主意。
与 SVN 不同,我们没有 WCREV.exe
随 TFS 安装。
在 TFS 中,最简单的方法是使用内部版本号作为版本号。有一个全局 .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
至于你想 get/set 程序集信息中的变更集编号。
您可以在内部版本号格式中使用 $(Build.SourceVersion)
来实现此目的,例如
$(BuildDefinitionName)_$(date:yyyyMMdd)_$(Build.BuildId).$(Build.SourceVersion)$(rev:.r)
然而,此 $(Build.SourceVersion) 仅在提交时自动触发构建(持续集成)时才有效。因为当您 运行 手动构建时,您必须在中输入源版本字段让它填充。更多详情请查看:Build.SourceVersion is blank in VSO vNext Build
您还可以使用 PowerShell 脚本获取源版本变更集编号并将其应用到您的内部版本号或 AssemblyInfo 中。