TeamCity Cloud 2024.12 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. You can use TeamCity parameter references.

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. Read more about these attributes in the Visual Studio documentation.

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 are created by means of the Visual Studio wizard, where all the AssemblyInfo files and content have a standard location.

Last modified: 19 September 2023