Search code examples
c#directoryexe

Execute exe from sub path then delete the call path


In C# I have an updater app and I want to run the updater from the main exe. Then I want the updater to delete the old main exe directory and replace it with the new version.

The error is when I call the updater from the main exe, the updater can not complete because the main exe directory is still in use so it hangs. When I run the updater exe every thing goes fine and the updater can delete main exe directory.


Solution

  • after a while I made the main app lunch from the updater so the updater will check if there is no updater then it will open the main exe and if there is an updater it will delete the main exe directory and replace it with the new version and the new version main contain an update for the updater so after the main exe run it will replace the old updater and every thing goes fine .