-
Notifications
You must be signed in to change notification settings - Fork 162
Description
I have an issue updating my application as the file is always locked an the following error occurs
Maybe there is something i'm not doing right?
Update task execution failed, failed to update the file is locked.
Using the latest nuget package
<?xml version="1.0" encoding="utf-8" ?> <Feed> <Tasks> <FileUpdateTask hotswap="true" updateTo="https://localhost.test/loader.exe" localPath="loader.exe"> <Description>Fixes several bugs with the display</Description> <Conditions> <FileVersionCondition what="below" version="0.0.0.5" /> </Conditions> </FileUpdateTask> </Tasks> </Feed>
`public LoginForm()
{
InitializeComponent();
UManager = UpdateManager.Instance;
UManager.UpdateSource = new SimpleWebSource("https://localhost.test/xml/update.xml");
UManager.Config.TempFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Equalitybots\Update");
CheckForUpdates();
}
private static void CheckForUpdates()
{
if(UManager.State != UpdateManager.UpdateProcessState.NotChecked) return;
try
{
UManager.CheckForUpdates();
}
catch (Exception e)
{
if (e is NAppUpdateException)
{
MessageBox.Show(e.ToString());
return;
}
else
{
MessageBox.Show(e.ToString());
return;
}
}
if(UManager.UpdatesAvailable == 0) return;
UManager.BeginPrepareUpdates(OnPrepareUpdatesCompleted, null);
}
private static void OnPrepareUpdatesCompleted(IAsyncResult asyncResult)
{
try
{
((UpdateProcessAsyncResult)asyncResult).EndInvoke();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return;
}
try
{
UManager.ApplyUpdates(true);
UManager.CleanUp();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return;
}
}`