从 TeamCity 中的外部文件设置构建参数 [英] Setting build parameters from external file in TeamCity

查看:32
本文介绍了从 TeamCity 中的外部文件设置构建参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 TeamCity AssemblyInfo Patcher 在所有 C# 程序集上设置程序集版本.我选择的版本方案是'Major.Minor.%build.number%.0'.当我在 TeamCity 中定义 Major 和 Minor 编号时,这工作正常,但理想情况下,我希望它们已经在我的 AssemblyInfo.cs 文件中定义,并且 TeamCity 只设置内部版本号的值.这可能吗?

I am currently setting the assembly version on all my C# assemblies using the TeamCity AssemblyInfo Patcher. The version scheme I chose is 'Major.Minor.%build.number%.0'. This works fine when I define Major and Minor numbers in TeamCity, but ideally I would like to have them already defined in my AssemblyInfo.cs file and have TeamCity only set the value for the build number. Is this possible?

我看到的一个解决方案是放弃使用 AssemblyInfo Patcher 并使用我自己的版本更新脚本,但这似乎很笨拙.

One solution I see is to forsake using AssemblyInfo Patcher and use my own version update script, but that seems heavy-handed.

推荐答案

您可以定义一个 参数文件,您将其签入版本控制,然后将方案更新为%system.major_version%.%system.minor_version%.%build_number%.0.然后您可以继续使用 AssemblyInfo Patcher,但根据 props 文件中的值修补所有内容.

You can define a parameters file which you check into version control, and then update the scheme to %system.major_version%.%system.minor_version%.%build_number%.0. Then you can keep using AssemblyInfo Patcher, but patch everything based on the values in the props file.

只需将以下内容放入项目根目录中名为 teamcity.default.properties 的文件中:

Just put the following in a file named teamcity.default.properties in your project root:

 system.major_version=3
 system.minor_version=15

这将导致构建号 3.15.1234.0 用于构建 #1234.

This will result in the build number 3.15.1234.0 for build #1234.

这篇关于从 TeamCity 中的外部文件设置构建参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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