Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue replacing exe #97

Open
equalitybots opened this issue Apr 21, 2017 · 1 comment
Open

Issue replacing exe #97

equalitybots opened this issue Apr 21, 2017 · 1 comment

Comments

@equalitybots
Copy link

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;
        }
    }`
@equalitybots
Copy link
Author

Issue seems to be that i'm forced to keep a version of NApp.Update.Framework.dll in the executable directory although packed with fody, is there a workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant