Updates not applied after application restart

246 views
Skip to first unread message

Dusan Smrek

unread,
Mar 22, 2013, 8:12:27 AM3/22/13
to nappu...@googlegroups.com
Hello,
after setting up a simple test application in a following fashion I cannot seem to get it to perform actual update.
Application is a simple exe that has dependency on single dll. DLL only contains class with 1 method to display version number (just as to check if the update was successful).
When running a test application finds the updates, applies 'em and then restarts. However upon restart still the same version number is displayed.
Thanks to anyone who can assist!
Dusan

Here's the code I am using in my testing scenario:

    public partial class Form1 : Form
    {
        #region Constructor

        public Form1()
        {
            InitializeComponent();
            SetupUpdateManager();
        }

        #endregion

        private void SetupUpdateManager()
        {
            UpdateManager.Instance.UpdateSource = new NAppUpdate.Framework.Sources.SimpleWebSource("http://localhost/feed.xml"); // provided is the URL for the updates feed
            //UpdateManager.Instance.ReinstateIfRestarted(); // required to be able to restore state after app restart
            // Clear temp folder
            const string updateDirectory = @"C:\Test\Updates";
            UpdateManager.Instance.Config.TempFolder = updateDirectory;
            if (Directory.Exists(updateDirectory))
            {
                try
                {
                    Directory.Delete(updateDirectory, true);
                }
                catch { }
            }
            Directory.CreateDirectory(updateDirectory);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            lblVersion.Text = VersionHelper.Version;
        }

        private void OnPrepareUpdatesCompleted(bool tru)
        {
            UpdateManager.Instance.ApplyUpdates(true);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (UpdateManager.Instance.CheckForUpdates())
            {
                UpdateManager.Instance.PrepareUpdatesAsync(OnPrepareUpdatesCompleted);
            }
            else
            {
                MessageBox.Show("Your software is up to date");
            }
        }
    }


Itamar Syn-Hershko

unread,
Mar 22, 2013, 8:18:49 AM3/22/13
to nappu...@googlegroups.com
This usually happens when the file you download is an older version, or you are testing this from VS environment (Ctrl-F5)




--
You received this message because you are subscribed to the Google Groups "NAppUpdate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nappupdate+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dusan Smrek

unread,
Mar 22, 2013, 9:01:52 AM3/22/13
to nappu...@googlegroups.com
Hi and thank you very much for reply! 
File residing in localhost directory is definitely of a newer version as it always get's picked up by CheckForUpdates and reports there's a 1 update to be applied.
And no, I am not testing directly from IDE. I have copied VS output into c:\test folder to avoid any permission issues on W7. Everything seems to be running just fine, no errors except after the application restarts it still showing the old version DLL...
For your convenience I have included the feed.xml generated via FeedBuilder tool. What I did was intentionally, after setting up an update, reverting DLL version back to version 1.0.0.0, so it does get picked up every run.
Another reason for this was I would like to be able to update only parts of the solution, as needed.

<?xml version="1.0" encoding="utf-8"?>
<Feed BaseUrl="http://localhost">
  <Tasks>
    <FileUpdateTask localPath="AutoUpdateTest.exe" lastModified="130084244151992989" fileSize="9728" version="1.0.0.5">
      <Conditions>
        <FileExistsCondition type="or" />
        <FileVersionCondition what="below" version="1.0.0.5" />
      </Conditions>
    </FileUpdateTask>
    <FileUpdateTask localPath="TestUpdate.dll" lastModified="130084244148642797" fileSize="4096" version="1.0.0.5">
      <Conditions>
        <FileExistsCondition type="or" />
        <FileVersionCondition what="below" version="1.0.0.5" />
      </Conditions>
    </FileUpdateTask>
  </Tasks>
</Feed>

Regards,
Dusan

Dusan Smrek

unread,
Mar 23, 2013, 2:09:33 AM3/23/13
to nappu...@googlegroups.com
I want to thank the author for his patience and very quick replies. Since then I was able to solve my problem.
All I had to do was grabbing the latest source, do the re-build and use output DLL. I can confirm that my little app updates as it should which made me very happy.
Thanks again!

Itamar Syn-Hershko

unread,
Mar 23, 2013, 1:03:55 PM3/23/13
to nappu...@googlegroups.com
Glad to hear that

John Russell

unread,
Jun 21, 2013, 1:07:13 PM6/21/13
to nappu...@googlegroups.com
I too am having this issue.  It even downloads the file to be updated to the temporary directory, but it doesn't ever seem to actually overwrite the old files in the working directory.  I checked the logs and it appears to be in the working directory.  What did you do to fix it exactly?  Just build the latest application from source?  I believe I already have the latest NAppUpdate.Framework.dll and it is still causing this issue.  Thoughts?

Itamar Syn-Hershko

unread,
Jun 22, 2013, 2:11:34 PM6/22/13
to nappu...@googlegroups.com
Don't really remember, this is an old thread. You should start by building from source, yes
Reply all
Reply to author
Forward
0 new messages