如何通过我们的CI平台(哈德森)我自动递增的C#程序集版本?版本、程序、哈德森、平台

2023-09-02 21:55:31 作者:感情是场徒有虚名的游戏

我和我的团队是可怕在递增程序集版本号,我们经常船舶装配与1.0.0.0版本。很显然,这会导致很多麻烦。

Myself and my group are horrendous at incrementing assembly version numbers and we frequently ship assemblies with 1.0.0.0 versions. Obviously, this causes a lot of headaches.

我们得到了很多与我们的实践更好地通过我们的 CI 的平台,我真的很想设置设置为自动递增值的AssemblyInfo.cs 文件中,使我们的程序集的版本自动更新该组件中的code的变化。

We're getting a lot better with our practices via our CI platform and I'd really like to set it up to auto increment the values within the assemblyinfo.cs file so that the versions of our assemblies are auto updated with the code changes in that assembly.

我有previously设置(之前我们发现哈德森)的方式来增加值或者通过的MSBuild 或命令行(记不清了),但与哈德森,会更新SVN库,并触发另一版本。这将导致缓慢的无限循环如Hudson轮询SVN每隔一小时。

I had previously setup (before we found Hudson) a way to increment the value through either msbuild or the command line (can't remember), but with Hudson, that will update the SVN repository and trigger ANOTHER build. That would result in a slow infinite loop as Hudson polls SVN every hour.

是具有哈德逊递增版本号是一个坏主意?什么是另一种方式做到这一点?

Is having Hudson increment the version number a bad idea? What would be an alternative way to do it?

理想情况下,我的标准溶液将是一个:

Ideally, my criteria for a solution would be one that:

增量的AssemblyInfo.cs 版本号的生成前 只递增已更改在程序集的版本号。这也许不可能的,因为哈德森每次做了构建时抹了项目文件夹 提交更改的AssemblyInfo.cs到code库(目前的VisualSVN ) 在不造成哈德森触发一个新的版本将在下一次扫描修改 Increments the build number in assemblyinfo.cs before a build Only increments the build number in assemblies that have changed. This may not be possible as Hudson wipes out the project folder every time it does a build Commits the changed assemblyinfo.cs into the code repository (currently VisualSVN) Does not cause Hudson to trigger a new build the next time it scans for changes

工作了这一点,在我的头上,我可以很容易地想出通过批处理文件/命令解决这个最,但我所有的想法会导致哈德逊触发一个新的版本将在下一次扫描。我不是在找人做了我的一切,只是点我朝着正确的方向发展,也许一种技术,让哈德森忽略某些SVN提交等。

Working this out in my head, I could easily come up with a solution to most of this through batch files / commands, but all of my ideas would cause Hudson to trigger a new build the next time it scans. I'm not looking for someone to do everything for me, just point me in the right direction, maybe a technique to get Hudson to ignore certain SVN commits, etc.

一切我发现到目前为止仅仅是一篇文章,解释如何获取自动递增的版本号,没有考虑到一个CI平台,可纺成一个无限循环。

Everything I've found so far is just an article explaining how to get the version number automatically incremented, nothing takes into account a CI platform that could be spun into an infinite loop.

推荐答案

一个简单的办法是让C#环境递增程序集版本为您设置的版本属性为major.minor。* (如在集信息文件模板描述。)

A simple alternative is to let the C# environment increment the assembly version for you by setting the version attribute to major.minor.* (as described in the AssemblyInfo file template.)

您可能会寻找一个更COM prehensive的解决方案,但。

You may be looking for a more comprehensive solution, though.

修改(回答这个问题在注释):

EDIT (Response to the question in a comment):

的AssemblyInfo.cs

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
 
精彩推荐
图片推荐