tags:

views:

51

answers:

1

Hi!

I'm doing ClickOnce updating via code (i.e. using the ApplicationDeployment object) and I've come across an unexpected issue:

Say I have version 1.0 installed. If I stick up a new version (say 1.1) and run the app, it'll update just fine to 1.1.

But if I then stick up a new version soon after (say 1.2) and run the installed app (1.1), it won't pick update the new version. That is until I run 1.1 the next day. It seems like about 24hrs later. Then it'll update to 1.2 as desired.

Any ideas what might be going on?

Thanks in advance for any help!

Gregg

PS Here's the code I'm using, after checking that the app's network deployed. This is part of a small update testing app so there's a bit of extra feedback in there...

        //
        //  CHECK WHETHER THERE'S AN UPDATE AVAILABLE
        //  No? Return.
        //
        UpdateCheckInfo updateInfo = null;
        ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;

        try  //  to see if there's an update
        {
            //  attempt to retrieve any updates
            Console.WriteLine("Checking for a detailed update now.");
            updateInfo = deployment.CheckForDetailedUpdate(persistUpdateCheckResult: false);
            Console.WriteLine("Check complete, appears successful.");
        }
        catch (Exception ex)
        {
            throw new Exception("Problem checking for updates: " + ex.Message + Environment.NewLine);
        }

        bool noUpdateAvailable = !updateInfo.UpdateAvailable;
        if (noUpdateAvailable)
        {
            Console.WriteLine("No update. This version is: " + deployment.CurrentVersion.ToString());
            return;
        }
        else
        {
            Console.WriteLine("There's an update available!");
        }

        //
        //  TRY TO UPDATE THE APP
        //
        Console.WriteLine("Attempting to perform update.");
        try
        {
            deployment.Update();
            Console.WriteLine("Update appears to have been successful. Restart the app!");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Update failed: " + ex.Message);
        }

RESOLVED: It beats me why, but I continued on to coding updating using the asynch options of the ApplicationDeployment class and now every update is detected. That's fine by me since asynch is what I need anyway.

Thanks guys for your ideas!

A: 

Check your cache settings on your web server. I cannot think of another reason why new ClickOnce files are not available.

Brett Veenstra
I checked this by updating a page on my website, the same site as where the app files are located, and the page updates with every change. So it looks like caching is not the prob. But thx for the idea!
Gregg Cleland