TFS和msbuild版本号与最近的变更集

问题描述:

我想创建一个类似Major.minor.Date.LastChangeSetInTFS的内部版本号,问题是如何从TFS中获取最后的变更集编号.有什么财产吗?

I want to create a build number which looks like Major.minor.Date.LastChangeSetInTFS, the problem is how to get last changeset number from the TFS. Is there any property, or something??

好吧,我终于找到了解决方案.这是一项任务,它将为您提供最新的变更集编号,并创建一个属性以将其插入到装配体信息内部版本号中.主要问题是缺少TfsLibraryLocation属性(没有它,它应该指向GAC中的库,但没有)

OK finally I've found a solution. Here's a task that will provide you the latest changeset number and create a property to insert it in an Assembly info build number. The main problem was in the missing TfsLibraryLocation property (without it, it should be pointing to libraries in GAC, but it didn't)

<Target Name="GetVersionChangeSet">
<TfsVersion
  TfsLibraryLocation="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies"      
  LocalPath="$(SolutionRoot)">
  <Output TaskParameter="Changeset" PropertyName="ChangesetNumber"/>
</TfsVersion>
<Message Text="TFS ChangeSetNumber: $(ChangesetNumber)" />