使 TeamCity 版本匹配 .NET 程序集版本 [英] Making TeamCity Version Match .NET Assembly Version

查看:29
本文介绍了使 TeamCity 版本匹配 .NET 程序集版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我们的程序集的版本号是 2.0.831.0.据我了解,这是主要版本、次要版本、日期和内部版本号.如果我在同一天进行更改并再次构建,则为 2.0.831.1、2.0.831.2 等.

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 again on the same day it's 2.0.831.1, 2.0.831.2 etc.

我的 TeamCity 内部版本号格式只是 2.{0} 其中 {0} 是一个自动递增的数字,它永远存在(2.195、2.196 等).

My TeamCity build number format is simply 2.{0} where {0} is an auto incremented number that just goes on forever (2.195, 2.196 etc).

如何使 TeamCity 看起来与程序集版本完全相同?我们希望能够将更改日志与程序集版本相关联,以便任何人都可以说程序集版本 2.0.831.2 在这些文件中进行了这些更改.

How do I make TeamCity look exactly like the assembly version? We want to be able to associate the Change Log with the assembly version so anyone can say assembly version 2.0.831.2 had these changes in these files.

额外信息:如果重要的话,我们的构建步骤使用Visual Studio (sln)"选项而不是MSBuild".如果重要的话,我们使用 Subversion 进行源代码控制.我们的 TeamCity 版本是 6.5.1(内部版本 17834).

Extra info: Our build step uses the "Visual Studio (sln)" option instead of "MSBuild" if that matters. We use Subversion for source control if that matters. Our TeamCity version is 6.5.1 (build 17834).

推荐答案

我建议您采用 语义版本控制方案 {major}.{minor}.{patch} 并为版本号添加第四个元素 {major}.{minor}.{patch}.{build}.这对于将构建日期包含在版本控制方案中更有用.

I would recommend you to adopt the semantic versioning scheme {major}.{minor}.{patch} and append a 4th element for the build number {major}.{minor}.{patch}.{build}. This is way more useful as to include the build date into the versioning scheme.

TeamCity 6.5(您尚未指定版本)具有构建功能,可用于在构建期间修补 AssemblyInfo.cs 中的版本.请参阅 AssemblyInfo Patcher 的文档.

TeamCity 6.5 (you haven't specified a version) has a build feature which could be used to patch the version in the AssemblyInfo.cs during the build. See the documentation for the AssemblyInfo Patcher.

然后,您可以按照您希望在程序集中使用的方式定义内部版本号格式,并将该格式用于内部版本本身,也可以用于修补功能.

You could then define the build number format in the way you would like to have in your assembly and use the format for the build itself, as also for the patching feature.

这篇关于使 TeamCity 版本匹配 .NET 程序集版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆