简体   繁体   English

版本号控制的想法

[英]Ideas For Version Number Control

Here's the development environment we're looking at: 这是我们正在研究的开发环境:

  1. Primarily .NET (C# mostly) 主要是.NET(主要是C#)
  2. Development in Visual Studio 2008 Visual Studio 2008中的开发
  3. Source control in SVN (VisualSVN server, Tortoise client) SVN中的源代码控制(VisualSVN服务器,Tortoise客户端)
  4. Deployments with MSBuild/MSDeploy controlled by Rake scripts 由Rake脚本控制的MSBuild / MSDeploy部署

What we'd like to start having is some kind of tracking of version numbers in deployments. 我们想开始拥有的是对部署中版本号的某种跟踪。 The main reasoning here is for a non-developer to be able to look at something on the Production systems and know at least what source control revision produced it, track version numbers in our ticketing system, etc. 此处的主要理由是,非开发人员能够查看生产系统上的某些内容,并至少知道由哪个源代码控制修订版产生了该产品,在票证系统中跟踪版本号等。

My first thought is to stamp every assembly at build time (via the Rake script, I would imagine) with a Major.Minor.Build version number scheme. 我的第一个想法是在构建时(我想像是通过Rake脚本)使用Major.Minor.Build版本号方案标记每个程序集。 We can manually set Major and Minor in the Rake script, those won't often change, and use the current SVN revision number as the Build. 我们可以在Rake脚本中手动设置Major和Minor,它们不会经常更改,并使用当前的SVN版本号作为Build。

Is there a better way to do this? 有一个更好的方法吗? Will the Build number get muddled by building from a tag of an older trunk revision? 通过较旧的主干版本的标签进行构建会混淆内部版本号吗? Any thoughts or advice on the matter? 关于此事有什么想法或建议吗? Maybe there's a tool somewhere that already does this rather well? 也许某个地方的工具已经做到了这一点?

since you're already using rake for your builds, i'd like to point out the Albacore framework which makes versioning your assemblies at build time really easy. 因为您已经在构建中使用rake,所以我想指出一下Albacore框架,该框架使在构建时对程序集进行版本控制非常容易。

http://github.com/derickbailey/Albacore http://github.com/derickbailey/Albacore

we provide an "assemblyinfo" task for rake that allows you to specify any assembly level attributes that you want - c# or vb.net. 我们为rake提供了一个“ assemblyinfo”任务,该任务允许您指定所需的任何程序集级属性-c#或vb.net。 for example: 例如:

desc "Run a sample assembly info generator"
assemblyinfo :assemblyinfo do |asm|
  asm.version = "0.1.2.3"
  asm.company_name = "a test company"
  asm.product_name = "a product name goes here"
  asm.title = "my assembly title"
  asm.description = "this is the assembly description"
  asm.copyright = "copyright some year, by some legal entity"
  asm.custom_attributes :SomeAttribute => "some value goes here", :AnotherAttribute => "with some data"
  asm.output_file = "lib/spec/support/AssemblyInfo/AssemblyInfo.cs"
end

you can see the asm.version in there, setting the version #. 您可以在其中看到asm.version并设置版本号。 it would be really easy to use a variable to set this instead of a hard coded string value. 使用变量而不是硬编码的字符串值来设置它真的很容易。

asm.version = "1.2.3.#{svnrevision}"

there is also an msbuild task which makes calling msbuild really easy, and about 20 more beyond that. 还有一个msbuild任务,它使调用msbuild变得非常容易,大约还有20个任务。 see the wiki page on github for a complete list. 有关完整列表,请参见github上的Wiki页面。

for more info on albacore, see these resources: 有关albacore的更多信息,请参见以下资源:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM