Versioning assemblies with Team Build 2010

It was a while that I was searching a way increasing version number of a .Net assembly by each build. In the beginning there were very ambiguity for myself that I tried to solve one by one:

1. When to increase assemblies version? Each time that developer builds the project on his (her) machine? Or each time that a build occurs in Team Build? Very soon I realized that is better to use Team Build because version number in each development machine may increase separately. Additionally Team Build maintains a database of all previous build for future uses.

2. By using Team Build based solutions I was unable to use patterns such as “1.0.*” for AssemblyVersion. I was forced to modify/generate AssemblyInfo.cs or some files like VersionInfo.cs. The question was if Team Build or something like MSBuild would change AssemblyInfo.cs, how can I see version information? There are two ways: get latest version, check-out AssemblyInfo.cs/VersionInfo.cs, modify, check-in and cause build based on them or get latest version, modify AssemblyInfo.cs/VersionInfo.cs without check-out/check-in, cause build based on them. Jimb Lamb says it’s a best practice to not check-in/check-out any changes during a build. I chose Jim’s approach.

3. Should I use MSBuild or Team Build? Use MSBuild’s tasks or Team Build’s process templates and activities? The answer was dependent on how I want generate build numbers. As I wanted to use Team Build’s build number in versioning and I wanted to access the history of a each assembly version, I chose Team Build because MSBuild’s tasks are not able to save history of builds in a database.

4. How can I use Team Build 2010 to do the versioning for me? By using TfsSdk: ActivityPack. There is an activity named “UpdateVersionInfo” in the pack. You should put in the bottom of “Overall Build ProcessRun On AgentInitialize Workspace” activity just after “Get Workspace” activity. Don’t forget to add arguments FileSpec, RegularExpression and VersionInfo with proper default values. Use “$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)” as build definition’s Build Number Format as “UpdateVersionInfo” needs those extra periods. For more info refer to Jim Lamb’s blog post describing it thoroughly.

Also see this blog posts and StackOverflow’s questions: link, link, link, link, link, link, link.


  1. ناشناس

    top [url=][/url] check the latest [url=]online casinos[/url] free no store bonus at the foremost [url=]baywatch casino

پاسخ دهید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *