TeamCity 2020.1 Help

AssemblyInfo Patcher

The AssemblyInfo Patcher build feature allows setting a build number to an assembly automatically, without having to patch the AssemblyInfo.cs files manually. When adding this build feature, you only need to specify the version format. Note that you can use TeamCity parameter references here.

AssemblyInfo Patcher should be used with the automatic checkout only: after this build feature is configured, it will run before the first build step. TeamCity will first perform replacement in the files found in the build checkout directory and then run your build.

TeamCity searches for all AssemblyInfo (including GlobalAssemblyInfo) files: .cs, .cpp, .fs, .vb in their standard locations under the checkout directory and replaces the parameter for the AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion attributes with the build number you have specified in the TeamCity web UI.

At the end of the build the files are reverted to the initial state.

Note that this feature will work only for standard projects, that is created by means of the Visual Studio wizard, so that all the AssemblyInfo files and content have a standard location.

Last modified: 28 July 2020