Traceability in .NET–1.0.*–part 2 of 7

Traceability in NET

Each project in Visual Studio contains a file named AssemblyInfo.cs that contains summary information about the component. We will discuss these lines:

// 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.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

As seen the traceability already exists in .NET .The difference between AssemblyVersion and AssemblyFileVersion is detailed here: http://support.microsoft.com/kb/556041

What we want to achieve is that after a change of the source code and recompile, the AssemblyVersion (or AssemblyFileVersion) to show us how we can "recover" source code

It is obvious that if we change the source code will remain all AssemblyVersion 1.0.0.0.

So if we want to have control over versions then we can modify the version manually .

In the following tutorials we will show various ways to automatically change the version, as well as to add other details in AssemblyDescription.

Official Way (1.0. *)

The easiest way is to put

[assembly: AssemblyVersion("1.0.*")]

In AssemblyInfo.cs and comment

//[assembly: AssemblyFileVersion("1.0.0.0")]

In this way, the version will increment every time.

The code on AssemblyInfo.cs will look as following:

// 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.*")]
// [assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]


Video: https://www.youtube.com/watch?v=jq6Uu64md1s

You can download the demo project here: http://traceabilitydemo.codeplex.com/releases/view/130512

The source code you can download from here:
https://traceabilitydemo.codeplex.com/SourceControl/changeset/view/110330

What is disturbing is not incremented so that we can see, for example, build on site.

Next time we will make same increment from Source control( TFS)