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.