How to use Assembly version number as build number in TeamCity?


Here is some details:
We are expermenting TeamCity 7.1 to build C# projects and solution. We have setup a project in TeamCity that builds the project as soon as any developer check-in any changes.

We currently use Visual Studio 2010 for developement and deployment purpose. We have a project in Visual Studio that generates the build number <major version>.<minor version>.<build number>.<revision> and use AssemblyInformation to stamp the build number when building the solution. Below is scenario:

Solution1.sln contains 4 projects.
- Project-1 has file called SharedAssemblyProperties.cs. This project contains code to generate the build number. For example : 5.2.1254.142
- Rest of 3 projects have reference to SharedAssemblyProperties.cs of project1.
- When we rebuild the Solution1 project1 updates the build number and assign that build number to all the assemblies in rest of the project.

We want to use this same version number from assemblyInformation as build number in the TeamCity. Is there any way to achieve this? I read this post However, this blog does not help to get build number from the file and I don't know where is that XML document is located.

Could someone please help / guide how to link this file OR retrieve the AssemblyInformation from SharedAssemblyProperties.cs and use it as build number in the TeamCity project?

Many thanks.

Please sign in to leave a comment.