Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing browsers to reload Silverlight xap after an update

I have a Silverlight control packaged up and deployed to a SharePoint web part. I'm having trouble with the browser loading new versions of the control after I push an update. I'm updating the assembly and file version of my xap project, but it doesn't seem to matter. The only way to get the browser to load the new xap is to go in and delete temporary Internet files. For me, during development, that's OK, but I'll need to find a solution before it's time for production. Any ideas?

like image 325
Chris Stewart Avatar asked Nov 12 '09 14:11

Chris Stewart


2 Answers

This has to do with how your browser handles resource requests. Flash has similar issues and there are a couple workarounds.

Here's an article that details the issue and possible solutions.

I would suggest doing something like this:

Say you have this for your xap in your html:

<param name="source" value="ClientBin/myApp.xap"/> 

I would version it so whenever you do a push you change the version number. Example:

<param name="source" value="ClientBin/myApp.xap?ver=1"/> 
like image 164
Joseph Avatar answered Oct 21 '22 01:10

Joseph


Great! Worked even in Windows Phone development.

I've put the line:

NavigationService.Navigate(new Uri("/Game.xaml?versao="+version, UriKind.RelativeOrAbsolute)); 

And then Override the method OnNavigatedTo:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) {     base.OnNavigatedTo(e);     string var;     if (NavigationContext.QueryString.TryGetValue("version", out var))     {         ...     } } 
like image 31
Dayana Viana Avatar answered Oct 21 '22 00:10

Dayana Viana