What is the Best Practice for implementing the semantic Version using TeamCity

TeamCity is a great CI tool, and we also use Semantic Versioning to manage our DLL version for a long time, now we are going to combine TeamCity and Semantic Versioning together, meanwhile we are doing some research on this topic, Let say version information, for example

MajorVersion.MinorVersion.PatchVersion.BuildNumber

In the buildNumber file, we always use the teamcity build number and the other 3 versions that we support in assemblyinfo.cs the question is here: how can we use the teamcity command to supply our build number in assemblyinfo.cs, I can find Msbuild to support this parameter, and Is there any best practice for handling the same? and we would also like to transfer the entire version to nuget packages in the form of published version information to our developers

thanks a lot

+4
source share
4 answers

I tried to describe the approach that works for me in this article. http://www.developerfusion.com/article/144809/continuous-integration-using-nuget-and-teamcity/

Note. NuGet does not fully support SemVer (yet), for example. PreereleaseTags combined with build numbers will not work as you expect. I have described a small guide to versioning the top 10 NuGet (Anti-) templates on MSDN .

+2
source

You can use the AssemblyInfo Patcher function. Assembly functions are configured on the Assembly Steps page of assembly configuration parameters. Here is described here . If you have AssemblyInfo in a non-standard location, you can use the MSBuild AssemblyInfo community task to rewrite it with msbuild.

+1
source

There is a very complete meta runner SemVer Build Number, available as part of the Meta-runers TeamCity power block ( https://github.com/JetBrains/meta-runner-power-pack ).

Here's a description of the author's features: http://johanleino.wordpress.com/2013/10/11/teamcity-meta-runner-semantic-version-build-number/

The SemVer Build Number meta runner is a PowerShell-based runner. It may (at the time of this publication):

  • Get version numbers from nuspec (nuget) files.
  • Use version numbers manually (from options if you need it). Overrides other methods.
  • Enable TeamCity build counter.
  • Enable VCS Revision.
  • Translate Git commit hash to a short hash.
  • Ignore the MetaData assembly if necessary.
  • Recording, etc.
0
source

Here on my blog I wrote about how to create version numbers from the first two numbers from AssemblyInfo.cs for a C # .Net project and add an assembly counter and a branch name to form the full version number. It can easily be changed for other situations, it just scripts along with the assembly function File Content Replacer .

http://www.meadow.se/wordpress/generating-semantic-version-build-numbers-in-teamcity/

Hope this helps.

0
source

Source: https://habr.com/ru/post/1434972/


All Articles