开发者

C#: how to set version number of assembly

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 thi开发者_运维技巧s version number to something different?


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")]


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.


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.


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.


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")]


If you need to change it on visual studio open your solution file then right click and select properties then select Application on that select assembly information than change version on assembly. enter image description here

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜