Hi Folk, The assembly version I can get with following loc:
Version version = Assembly.GetEntryAssembly().GetName().Version;
But how can I get the assembly file version?
Thanks for help.
Hi Folk, The assembly version I can get with following loc:
Version version = Assembly.GetEntryAssembly().GetName().Version;
But how can I get the assembly file version?
Thanks for help.
public static string GetProductVersion() { var attribute = (AssemblyVersionAttribute)Assembly .GetExecutingAssembly() .GetCustomAttributes( typeof(AssemblyVersionAttribute), true ) .Single(); return attribute.InformationalVersion; }
(From http://bytes.com/groups/net/420417-assemblyversionattribute - as noted there, if you're lookign for a different attribute, substitute that into the above)
See my comment above asking for clarification on what you really want. Hopefully this is it:
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
string version = fvi.ProductVersion;
There are three versions: assembly, file, and product. They are used by different features and take on different default values if you don't explicit specify them. For more info see: http://all-things-pure.blogspot.com/2009/09/assembly-version-file-version-product.html.