I am working on desktop application. I have create a setup.
Ex. My Application. Version is 1.0.0.
I want to get the current version
Get the version of a specific assembly:
private const string AssemblyName = "MyAssembly"; // Name of your assembly
public Version GetVersion()
{
// Get all the assemblies currently loaded in the application domain.
Assembly[] assemblies = Thread.GetDomain().GetAssemblies();
for (int i = 0; i < assemblies.Length; i++)
{
if (string.Compare(assemblies[i].GetName().Name, AssemblyName) == 0)
{
return assemblies[i].GetName().Version;
}
}
return Assembly.GetExecutingAssembly().GetName().Version; // return current version assembly or return null;
}