Reputation: 119
TeamCity is a great CI tool and we also use Semantic Versioning to manage our DLL version for a long time, now we are reaching a idea to integrate TeamCity and Semantic Versioning together, meanwhile we do some research on this topic, Let's say the Version infor like
MajorVersion.MinorVersion.PatchVersion.BuildNumber
The buildNumber we always use teamcity buildnumber, and other 3 versions we maintains within assemblyinfo.cs the question here is - how can we use teamcity to feed its build number into assemblyinfo.cs, i can find Msbuild support this parameter, and is there any best practice to handle the same thing? and we also would like to feed the whole version into nuget packs as the published version information to our developers
Thanks a lot
Upvotes: 4
Views: 4899
Reputation: 569
Here's a blog post I wrote of how to create version numbers from the first two numbers from AssemblyInfo.cs
for a C# .Net project and adding a build counter and branch name to form the complete version number. Can easily be modified for other situations, it's just scripts together with the File Content Replacer build feature.
http://www.meadow.se/wordpress/generating-semantic-version-build-numbers-in-teamcity/
Hope this helps.
Upvotes: 0
Reputation: 1328
There is a very complete SemVer Build Number meta-runner available as part of the TeamCity meta-runners power pack (https://github.com/JetBrains/meta-runner-power-pack).
Here's a description of the features by the author: http://johanleino.wordpress.com/2013/10/11/teamcity-meta-runner-semantic-version-build-number/
The SemVer Build Number meta-runner is a runner based on PowerShell. It can (at the time of this posting):
Upvotes: 0
Reputation: 14810
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/
Notice NuGet doesn't support SemVer fully (yet), e.g. PrereleaseTags combined with build numbers won't work the way you expect it to. I've described a bit of guidance on versioning in Top 10 NuGet (Anti-)Patterns on MSDN.
Upvotes: 2
Reputation: 7747
You can use AssemblyInfo Patcher feature. Build features are configured on the Build Steps page of the build configuration settings. It's documented here. If you have are keep your AssemblyInfo in not standard place you can use MSBuild community task AssemblyInfo
to rewrite it by msbuild.
Upvotes: 1