Friday, May 1, 2009

Extract Assembly version

Here is how to proceed in order to extract the version number from an .NET assembly file.

Extract version of an assembly file

This example shows you how to extract the assembly version from an assembly which name we know:

C# .NET

Assembly assembly = Assembly.LoadFrom("MyAssembly.dll");

Version ver = assembly.GetName().Version;

Extract version of the current assembly

This example shows you how to extract the assembly version from the current executing assembly:

C# .NET

Assembly.GetExecutingAssembly().GetName().Version;



kick it on DotNetKicks.com

No comments: