Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Assembly Version in a compiled .NET assembly

Tags:

.net

Simple question... is there a way to change the Assembly Version of a compiled .NET assembly?

I'd actually be fine with a way to change the Assembly File Version.

like image 239
Mike Avatar asked Dec 29 '08 17:12

Mike


People also ask

Where is version information stored of an assembly?

The version number is stored in the assembly manifest along with other identity information, including the assembly name and public key, as well as information on relationships and identities of other assemblies connected with the application.

What is the difference between assembly version and assembly file version?

AssemblyVersion: Specifies the version of the assembly being attributed. AssemblyFileVersion: Instructs a compiler to use a specific version number for the Win32 file version resource.

What is assembly version in C#?

It's the version number used by framework during build and at runtime to locate, link, and load the assemblies. When you add reference to any assembly in your project, it's this version number that gets embedded.


1 Answers

You can use ILMerge:

ILMerge.exe Foo.dll /ver:1.2.3.4 /out:Foo2.dll

A valid reason to do this is to increment the assembly version in a build in you find breaking changes (using NDepend for example). That way if there are no breaking changes the assembly version stays the same, and you can patch released builds easily.

We always increment the file version, and that reflects the build number.

like image 186
MarkGr Avatar answered Sep 30 '22 21:09

MarkGr