开发者

Ideas For Version Number Control

开发者 https://www.devze.com 2023-01-05 05:14 出处:网络
Here\'s the development environment we\'re looking at: Primarily .NET (C# mostly) Development in Visual Studio 2008

Here's the development environment we're looking at:

  1. Primarily .NET (C# mostly)
  2. Development in Visual Studio 2008
  3. Source control in SVN (VisualSVN server, Tortoise client)
  4. Deployments with MSBuild/MSDeploy controlled by Rake scripts

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 Maj开发者_运维技巧or.Minor.Build version number scheme. 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.

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.

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. 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 #. 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. see the wiki page on github for a complete list.

for more info on albacore, see these resources:

  • http://github.com/derickbailey/Albacore
  • http://albacorebuild.net
  • http://groups.google.com/group/albacoredev
  • http://code-magazine.com/Article.aspx?quickid=1006101
0

精彩评论

暂无评论...
验证码 换一张
取 消