C# Updater for Windows App
i developed an updater application for my windows app. They are different projects under the same solution and they run as different processes. when i run the app it checks fo开发者_Python百科r updates at startup (as another process). when i click update button it tries to download files to the installation location. (i am using the .exe in debug folder i don't create setup file) Everything works fine but the main application (app.exe) can't be overwritten because it is used by update process. but in update process i kill app.exe and app.exe goes from task manager too. i couldn't find anything, how main app.exe is used by update. has anyone any idea how update uses main app ? how can i watch it? in which line it starts using the other app?
- Rename app.exe
- Insert new app.exe
- Close running, old app.exe
- Start new app.exe
- Check for renamed app.exe (in newly started app.exe)
- Delete old, renamed app.exe
If the updater app has a reference to the main app exe, it will keep it locked. If that's the case, can you remove the reference to the main app from the update app project? This may need moving some code directly into the updater's source.
To find out who has a hand on your process you should start ProcessExplorer. There are some spy glasses in the menu bar. Just click on it and see which process holds a handle to your app.
Do you need to invent your own? There are existing solutions that you may be able to leverage that already do this. Microsoft ClickOnce supports this if it fits your deployment model.
A quick google search turns up a few things as well:
- http://csautoupdater.sourceforge.net/
- http://www.codeproject.com/KB/vb/Auto_Update_Revisited.aspx
精彩评论