Bruno Denuit-Wojcik
Bruno Denuit-Wojcik

Reputation: 77

Setting build parameters from external file in TeamCity

I am currently setting the assembly version on all my C# assemblies using the TeamCity AssemblyInfo Patcher. The version scheme I chose is 'Major.Minor.%build.number%.0'. This works fine when I define Major and Minor numbers in TeamCity, but ideally I would like to have them already defined in my AssemblyInfo.cs file and have TeamCity only set the value for the build number. Is this possible?

One solution I see is to forsake using AssemblyInfo Patcher and use my own version update script, but that seems heavy-handed.

Upvotes: 5

Views: 3466

Answers (1)

Tomas Aschan
Tomas Aschan

Reputation: 60574

You can define a parameters file which you check into version control, and then update the scheme to %system.major_version%.%system.minor_version%.%build_number%.0. Then you can keep using AssemblyInfo Patcher, but patch everything based on the values in the props file.

Just put the following in a file named teamcity.default.properties in your project root:

 system.major_version=3
 system.minor_version=15

This will result in the build number 3.15.1234.0 for build #1234.

Upvotes: 9

Related Questions