I'm wondering how to setup my Silverlight project to enable automatic updates for out-of-browser application.
I added some code in app.xaml.cs (see below), rebuild app, installed as out-of-browser, changed versionionfo in asseblyinfo.cs, rebuilded, run again but unfortunatelly no update happened. Am I still missing something?
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
if (Application.Current.IsRunningOutOfBrowser)
{
App.Current.CheckAndDownloadUpdateCompleted +=
new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted);
App.Current.CheckAndDownloadUpdateAsync();
}
}
void App_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
{
if (e.Error == null && e.UpdateAvailable)
{
MessageBox.Show("Application updated, please restart to apply changes.");
}
}
EDIT
Bonus question:
How App detect that there is an update? From assemblyinfo.cs? Somewhere in manifests?
EDIT
Can anybody explain me WHY IsRunningOutOfBrowser
returns always FALSE even if App is run from desktop's shortcut?