WmAutoUpdate - Has anyone used it? Not rollback

I created a Compact Framework application and I use WmAutoUpdate to deploy new versions on mobile devices ( http://www.sebastianvogelsang.com/2009/09/23/wmautoupdate-a-net-compact-framework-auto-update-library/ ) Has anyone used this? This is cool, but I have a problem.

If I make the application crash halfway through the update, it should recover by copying the backup version back to the main directory. This does not work because the exe file is "locked" by the operating system because it is currently in use. I can verify this because I cannot delete it using Windows Explorer. Error Details:

System.IO.IOException was unhandled
Message="IOException"
StackTrace:
     at System.IO.__Error.WinIOError(Int32 errorCode, String str)
     at System.IO.File.Move(String sourceFileName, String destFileName)
     at WmAutoUpdate.Updater.assertPreviousUpdate()
     at WmAutoUpdate.Updater..ctor(String url)

An error occurs on this line in Updater.assertPreviousUpdate ():

File.Move(f, appPath + "\\" + getFilenameFromPath(f));

exe , ( , ). , .

Cheer

+3
1

WmAutoUpdate, . , , . , WmAutoUpdate , . :

if (Directory.Exists(backupDir))
{
  string tmpDir = Path.Combine(Path.GetTempPath(),Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
  Directory.Move(appPath, tmpDir);
  Directory.Move(backupDir, appPath);
}

Temp. . , .TMP Temp . .

0

Source: https://habr.com/ru/post/1783736/


All Articles