c# - FileVersionInfo.GetVersionInfo getting old version of an exe swapped at runtime -


I have implemented a program in C # which is sometimes updated when it comes to any new XE Swapping and running. I want a regular checkup program that has been updated and if so, then restart I use the following function to do this.

  Public Stable Boole DoineedToRestart (string exe_name) {version cur_version = new version (MainProgram.StartVersion); Version file_version = new version (GetProductVersion (exe_name)); MessageBox.Show ("cur_version comparison" + cur_version.ToString () + "with" + file_version.ToString ()); If (file_version> cur_version) {true back; }         return false; } Public Static String GetProductVersion (string path_name) {FileVersionInfo myFI = FileVersionInfo.GetVersionInfo (path_name); Return to my IFI; }  

MainProgram.StartVersion is set when the program starts running version using GetProductVersion (exe_name)

set the name of executable to exe_name Has been done that is being updated

the main program. The Exe file has been updated once (I'm seeing it by looking at the file properties manually and checking the file version), once the problem gets, GetProductVersion still returns the old file version and I do not know Why! Any help is greatly appreciated. I'm running Windows Vista with Net 3.5.

What operating system? If it's Windows, then I'm afraid that you're wrong about swapping the .exe file of accessing - all running programs in the Windows kernel are locked by virtual memory managers. It is entirely possible that you have some .NET libraries, redirections behind the scenes to see that the new file is in place, but only that file access will be affected through that library.

EDIT: As far as I know, Windows only stops attempts to delete or rename executables that are mapped to memory, but also all parents' directories Are there. Since you are on Vista, it is actually possible that you are looking at the effect of a mask - for non-administrator programs, Windows writes, and later the directory of windows and program files reads per-user in the virtual area. If you are starting a program through any non-high means, then you can actually run a copy of the app in the virtual area. The Installer Service (MSIEXEC) operates with full fledged rights, so this redirection is immune. Therefore, I believe that the Windows Installer overwrites the version in the C: \ program file, while your app% sees the version from USERPROFILE% \ AppData \ Local \ VirtualStore \ Program Files, whatever the overlay is, which is Is unchanged. Generally if the version changes in the "real" directory, then there will be a new revision time compared to its overlay version, so the "real" version will be used. But if the installation process is preserving revision time, then it is possible that there is a recent time in the overlay and it continues to be used.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -