Automatically updating a file with Revision from TFS?

天大地大妈咪最大 提交于 2019-12-22 07:59:34

问题


I'm quite new to TFS (actually I only use it because I have some projects on CodePlex and did not want to go through svnbridge), and I'm looking for something equivalent to the $Revision$ parameter in SVN.

Essentially on checkout, I want to update a file to contain the newest Revision number, to be displayed as Version number (just like at the bottom of SO).

Is there anything already built-in in msbuild of .net 3.5 SP1, or any official/standard msbuild task, or even something equivalent of just dropping $Revision$ and having the TFS client do the magic on checkout?


回答1:


Keyword expansion is not currently supported in TFS. This often takes people by suprise. Below are a couple of blog posts on the topic, you will also find a link there to take you to the Microsoft site if you want to vote for the feature. I know that it is something that the Team get asked for from time to time - but they have yet to come across anyone that actually needs keyword expansion anymore, just a lot of folks are kinda just used to it.

Anyway - have a read and see what you think.

  • Buck Hodges - Keyword expansion in TFS
  • Me - Why have Keyword Expansion?



回答2:


Michael,

From within a Team Build you can access the changeset number being built using the $(SourceGetVersion) variable. You could override the AfterGet or BeforeCompile extensibility targets and push the contents of this variable into whatever files you need it in.

Regards,

William D. Bartholomew (Team System MVP)



来源:https://stackoverflow.com/questions/841625/automatically-updating-a-file-with-revision-from-tfs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!