tags:

views:

78

answers:

5

I have written a DLL in C# using VS2005.

Currently the DLL is showing a version number of 1.0.0.0.

How do I set this version number to something different?

+8  A: 

look in the AssemblyInfo.cs file for the following line, and set it to whatever version number you want:

[assembly: AssemblyVersion("1.0.0.0")]
Mark Heath
Very true, There is another way, I'm not sure about VS2005 but at least VS2008 and up has the properties item in the solution explorer, double-click it, it in you also edit the assembly version
Pieter888
Can someone confirm whether this is possible in VS2005?
Craig Johnston
That is how to set the assembly version, yes. The properties item just sets the value in the assemblyinfo file.
Josh Smeaton
+1  A: 

Alter this line in AssemblyInfo.cs:

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.9.10292.8")]
Mitch Wheat
+1  A: 

You can set the version number in 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.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Note that the assembly version is not the same as the assembly file version. From your brief description it sounds more like you are looking for the latter - AssemblyFileVersion.

Mark Byers
They're both likely to be the same, aren't they?
Craig Johnston
+2  A: 

You can either specify the file version using the AssemblyFileVersionAttribute directly...

Instructs a compiler to use a specific version number for the Win32 file version resource.

...or you can remove this attribute entirely which will mean that the file version defaults to the assembly version. This is probably good practice as having a file version that is different to the assembly version will cause confusion.

If the AssemblyFileVersionAttribute is not supplied, the AssemblyVersionAttribute is used for the Win32 file version that is displayed on the Version tab of the Windows file properties dialog.

You can set the assembly version using the AssemblyVersionAttribute.

Assembly attributes are usually applied in the AssemblyInfo.cs file as stated in the other answers.

Scott Munro
A: 

Right click the project and click properties. The properties window will appear. In that click Application tab. It will show application information of the project. There will be a button named Assembly Information. click the button, it will show you a form containing assembly information of the project. You can specify the assembly version (contains four text boxes, i.e., Major Version, Minor Version, Build Number, Revision). It will store the assembly details in AssemblyInfo.cs of the corresponding project.

Kumaran T