You all might be familiar with Assembly.LoadFrom method which can be use to get the version of the assembly but this method has a disadvantage as it will load the assembly into the domain and you will not be able to update that assembly after loading the assembly until the current app domain is unloaded. The solution is to use AssemblyName.GetAssemblyName. This method causes the file to be opened and closed, but the assembly is not added to this domain.
// Get current and updated assemblies
AssemblyName currentAssemblyName = AssemblyName.GetAssemblyName(currentAssemblyPath);
AssemblyName updatedAssemblyName = AssemblyName.GetAssemblyName(updatedAssemblyPath);
// Compare both versions
if (updatedAssemblyName.Version.CompareTo(currentAssemblyName.Version) <= 0)
// There's nothing to update
What kind of email newsletter would you prefer to receive from CodeAsp.Net?