Задайте вопросЗадайте вопрос
 

ОтвеченоApplication Auto-Update Question

  • 6 июня 2008 г. 19:38IrishJoker Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Hi,

    I've written an application which will run constantly and from a remote location.

    What I want to do is to have the application checking weekly for updates and if there's a newer version then update to the new version.

    So what I need to know, what is the best way to go about doing this.
    Obviously an application cannot update itself because it needs to be closed to update it.

    What I was thinking was, having an application running that starts my application, and it checks weekly for an new update, if it finds it it closes my application, updates it and then restarts it with the update applied.

    The way the update will be applied is to overwrite the application that's already there(while also keeping a backup of the old version just incase).

    So would this be the best way to do something like this - anyone got any other suggestions or point me to some sites that can help me do this.

    Thanks alot,

    Eoin...

Ответы

  • 6 июня 2008 г. 20:32Matt Galbraith - MSFTМодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено
    Hi Eoin,
        
        ClickOnce has done about 90% of the work for you there already.  If you can publish your app as a ClickOnce app, you can simply tell it to check for updates every 7 days from an arbitrary URL you specify, then write an app to restart your ClickOnce app when it updates itself.

    Interesting ClickOnce update article here.

    Simply go to your project properties, "Publish" tab, and click "Updates".  You'll want to select "The Application should check for updates", the "After the application starts" option (since the "before" option will require user intervention).   Additionally you can programatically check for updates whenever you like.  When updates are available, you can programatically apply them.  There's a good sample of that here: http://msdn.microsoft.com/en-us/library/ms404263(VS.80).aspx .

    Once you've updated your app, you will need to restart it.  Here's where the extra 10% of work comes in.  You'll want to write an app (could even include this as a "content" file with your CLickOnce deployment) that runs on this machine, and monitors for when your app's process closes.  When you detect an update, you'd want to start this process via Process.Start(), then simply call Application.Current.Shutdown();.  When the process exits, the special "restarter" app can just re-invoke it via its shortcut in the start menu (.appref-ms.... clickonce apps are special like that)... and you have your self-sustaining app update scenario.

    Hope this helps,
    Matt

    SDET : Deployment/Hosting
    • Помечено в качестве ответаIrishJoker 6 июня 2008 г. 20:53
    • Снята пометка об ответеIrishJoker 6 июня 2008 г. 21:27
    • Помечено в качестве ответаIrishJoker 6 июня 2008 г. 22:11
    •  
  • 6 июня 2008 г. 21:44Paul Czywczynski Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     Отвечено
    Not true, our application runs in full trust and is deployed via click-once. There are two different types of WPF click-once applications; normal EXEs and XBAPs. XBAPs are click-once deployed inside the browser and thus run in a sandbox.
    • Помечено в качестве ответаIrishJoker 6 июня 2008 г. 22:11
    •  

Все ответы