I am wondering how to set up my Silverlight project to enable automatic updates for an off-tier application.
I added the code to app.xaml.cs (see below), rebuild the application installed as outside the browser, changed versionionfo to asseblyinfo.cs, rebuilt, started again, but, unfortunately, the update did not happen. 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 does the application detect that there is an update? From assemblyinfo.cs? Somewhere in the manifest?
EDIT
Can someone explain to me WHY it IsRunningOutOfBrowseralways returns FALSE, even if the application starts from a shortcut on the desktop?
source
share