开发者

Is manually (and silently) updating a ClickOnce app going to be a stable way of deploying updates?

I've deployed an application inside a corporate network and I want the update process to require less attention from users, similar to how Google Chrome install updates - in the background. I don't need to give the user a choice to update.

I've used the System.Deployment library to detect when new ClickOnce updates are available and install them automatically. I'm wondering if its necessary to restart the app after the update is complete. Currently I invoke Application.Restart() at the end of my update script.

But what if (to make the update process more transparent for the user) I performed a 'silent' async update and then displayed an icon prompting the user to restart the app to apply the changes? Would this make the app unstable in any way?

Furthermore, if I ran my custom InstallUpdate() process on a timer, say every 30 minutes, would ClickOnce be stable to continue to upd开发者_运维技巧ate for every new version that was released even thought the user has not restarted (nb: I'm expecting the updates to only apply once the user restarts the app)?


I would think it depends on what your application does at startup, and what it's doing when the update is installed and the application is restarted, and what the update contains. You could try running it and then attaching a debugger to it and see what it's doing and what impact it has.

For example, our application loads a lot of information into memory when it starts up. If the update included a change to one of the data structures, and the app didn't reload the data for some reason, it would cause a problem.


After a few years of doing it like this, we have found that it is possible to silently install updates this way. However there are a few issues to be aware of:

  1. If the thread terminates prematurely during the Update() (eg: the user exits out of the app while the updating is in progress), the install will become corrupt and the next time the user loads the app, the ClickOnce normal deployment will fire off and re-install the app.

  2. The user's desktop icons always redraw (flicker) after an update is installed.

  3. Calling ApplicationDeployment.CurrentDeployment.CheckForUpdate() more than 65536 times causes a System.NullReferenceException Source.

    An alternative is not to actually check for an update, I have found that this locks one of my dlls and prevented a form from loading, so use with care:

    If ApplicationDeployment.CurrentDeployment.Update Then ' update app
        console.writeline("update installed")
        ' code to inform user update was sucessfull and they need to restart
    End If
    
  4. If your ClickOnce project is 32bit, and you run it on an x64 platform, any file associations your app has will break after performing a manual ClickOnce update. See this MS support case for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜