I have an internal intranet application as a exe file (win32, written in Delphi).
I regularly update it with new features and patches.
Many people are accessing the same exe (using it with remote desktop).
In Windows Server 2003 to replace the file I just needed to:
rename the old file, copy the new file.
This is not possible in 2008 anymore since because of same caching the new file doesn't work. It runs but then there are problems (probably linked to the way Delphi uses the exe resources). The only way is to close all the users sessions and replace the file.
May you suggest a method that works? Simple if possible? Is it possible to disable this caching? Or any other trick that allows me to replace a file (without changing the full path).
Schedule a maintenance window and replace the file when there are no users working with it. Just because Server 2003 allowed you to get away with doing something the wrong way, doesn't mean 2008 should.
The part where you mention this:
is the right way to go about it.
As an alternative, you could create a new launcher that never changes. It will read which version of the executable to start, and start the updated version.
So if the end-user shortcuts point at filename.exe, then that is what you would name your launcher, the launcher might read the file filename.versions, then execute filename.version.exe.
I guess if you use UPX compressor, you'll be able to remove the executable. Once the .exe is decompressed on the ram.