views:

93

answers:

1

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 Major.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?

+1  A: 

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:

Derick Bailey
I'll test it out on Monday, thanks!
David