I am working on a patching system and I have one last bug i need help working out. My patching system is slit into two parts. The main gateway which displays all the information, and then there’s the actually patching extraction itself. The gateway will check the server to see if there’s a newer version available. If there is, the gateway closes and the extractor opens. The extractor then downloads one patch at a time, extracts it, then starts over until there is no more new patch sets on the server. The problem I am having is that i need the extractor to check against the assembly version of the gateway. I know how to get the assembly version from within a program, but how do you get the assembly reference of an external program?
I’ve also tried using the file version instead of assembly version, which would allow me to check against the file version of another program but it give an error. Here the code and the error:
Code:
static string extractLocation = ProgramFilesx86();
static FileVersionInfo ver = FileVersionInfo.GetVersionInfo(extractLocation + "\\Divine Shadows\\Divine Shadows.exe");
static string Installed_Version = ver.ToString();
static string Latest_Version = GetLatestVersion();
Version v1 = new Version(Installed_Version);
Version v2 = new Version(Latest_Version);
Error:
Message=Version string portion was too short or too long.
I don’t care whether I use file version of assembly version, i just need a way to check against the version from an external source. Any suggestions?
P.S. I need to be able to compare both versions in order to check if the current version is the latest version.
Try this:
Here is more info about AssemblyName and GetAssemblyName method