Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Assembly Version (not File Version) for another EXE?

Tags:

c#

.net

You can use the following to get the File Version:

FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo("filename.exe"); 

But how can you get the Assembly Version for a specific EXE file?

like image 403
Keith Maurino Avatar asked Apr 27 '10 19:04

Keith Maurino


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.

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 file version?

It's the version number given to file as in file system. It's displayed by Windows Explorer, and never used by . NET framework or runtime for referencing.

What is assembly versioning in C#?

The assembly's version number, which, together with the assembly name and culture information, is part of the assembly's identity. This number is used by the runtime to enforce version policy and plays a key part in the type resolution process at run time.


1 Answers

From this blog article How to get assembly version without loading it:

AssemblyName.GetAssemblyName("filename.exe").Version 

This avoids having to load the assembly in its entirity.

like image 129
Daniel Renshaw Avatar answered Oct 01 '22 02:10

Daniel Renshaw