Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting build parameters from external file in TeamCity

Tags:

c#

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.

like image 543
Bruno Denuit-Wojcik Avatar asked Jan 04 '16 14:01

Bruno Denuit-Wojcik


1 Answers

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.

like image 62
Tomas Aschan Avatar answered Nov 15 '22 04:11

Tomas Aschan