Wednesday, 11 January 2012

Get Assembly Version

Below code would help you get the Assembly version.
This code also stamp the build version in a file where you want to write the build version.
The build version is nothing but versioning provided after building the Project from tfs.
so here the code:
///

/// This method will get the version
///
/// return version of version as string
private static string GetVersion()
{
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
return fileVersionInfo.ProductVersion;
}

Thanks,
Md. jawed

No comments: