Making TeamCity Version Match .NET Assembly Version

后端 未结 2 569
一个人的身影
一个人的身影 2021-02-02 15:25

Right now our assemblies have a version number like 2.0.831.0. As I understand it, that\'s major version, minor version, date and build number. If I make a change and build ag

2条回答
  •  再見小時候
    2021-02-02 16:13

    One solution is to use the MSBuild runner, and write an MSBuild script which reads the version information from the AssemblyInfo file, sets the TeamCity build version to that value whilst running the build, then increments the build number part of that version, and writes the value back to the AssemblyInfo.

    This isn't particularly trivial, as you need to have an understanding of writing custom MSBuild scripts, and you will likely need to use some of the community tasks etc to read/write the version information.

    We also use the concept of a global AssemblyInfo file, which all of our assemblies reference (using Add Link in VS), and thus we only need to update the one file during the build.

    There is an excellent article here, which describes doing common CI tasks with MSBuild. He is using CruiseControl.NET, but much of it still applies. If you are running TeamCity 6.5 though, I would look into using its build features exclusively, as this will be much easier to maintain than a custom MSBuild script.

提交回复
热议问题