Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by Asnivor for Semantic versioning in WPF projects

I use this method in my WPF applications (although its for the fileversion rather than the assembly version - I always have these the same in my small projects):

public static string ReturnApplicationVersion(){    System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();    FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);    string versionMajor = fvi.ProductMajorPart.ToString();    string versionMinor = fvi.ProductMinorPart.ToString();    string versionBuild = fvi.ProductBuildPart.ToString();    string versionPrivate = fvi.ProductPrivatePart.ToString();    string fVersion = fvi.FileVersion;    return versionMajor +"."+ versionMinor +"."+ versionBuild +"."+ versionPrivate;}

You can easily modify it to return just 3 numbers. If you absolutely have to have the assembly version rather than the fileversion then perhaps someone else can help.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>