Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I retrieve the version of an Assembly in C#?

I have a reference to a type, for which I would like to retrieve the version number of the Assembly in which it is located.

What is the best way to do this?

like image 517
Bernie Avatar asked Oct 29 '08 19:10

Bernie


People also ask

How do I find my assembly version?

"Assembly File Version" is what shows when you right-click on a file and go to "properties" then the "details" tab. They are not the same. I've found that the assembly version is what's used when determining the user. config location in AppData.

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 an assembly version?

The Product version of the assembly. This is the version you would use when talking to customers or for display on your website. This version can be a string, like '1.0 Release Candidate'. The AssemblyInformationalVersion is optional. If not given, the AssemblyFileVersion is used.

What is assembly version and assembly file version?

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,

x.GetType().Assembly.GetName().Version
like image 93
ckarras Avatar answered Nov 09 '22 06:11

ckarras