Automatic Update in Silverlight 5

253 Views Asked by At

We have three Silverlight applications that run out of browser. We have code in these applications so the application will automatically be updated when a new version becomes available. This feature has suddenly stopped working in one of the three applications. The code as far as I can tell is the same in all three applications. If I uninstall and reinstall the application by running it from a browser and right-clicking to uninstall and reinstall that works ok. But this is not a great solution because it means I have to visit each user to fix their desktop. I trace this a bit and found I was reached the paragraph that checks for update but e.UpdateAvailable is false. I’m not sure what to try next.

Here is my code

Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup



    Me.RootVisual = New MainPage

    Dim l_CurrentHost As String = App.Current.Host.Source.OriginalString

    If l_CurrentHost.Contains("localhost") = True Then

        Exit Sub
    End If


    If App.Current.IsRunningOutOfBrowser Then


        m_Update.startProgress()

        m_Update.Show()

        AddHandler App.Current.CheckAndDownloadUpdateCompleted, AddressOf DownloadUpdateCompleted
        App.Current.CheckAndDownloadUpdateAsync()


    End If



End Sub
Private Sub DownloadUpdateCompleted(ByVal sender As Object, ByVal e As CheckAndDownloadUpdateCompletedEventArgs)
    m_Update.endProgress()
    'Exit Sub
    '   MessageBox.Show("1")

    '   MessageBox.Show("We got to #3 " & e.UpdateAvailable)

    If e.UpdateAvailable Then

        MessageBox.Show("An application update has been downloaded, and will close. " & _
        "Restart the application to run the new updated version.")

        App.Current.MainWindow.Close()

    ElseIf e.Error IsNot Nothing AndAlso _
        TypeOf e.Error Is PlatformNotSupportedException Then

        MessageBox.Show("An application update is available, " & _
            "but it requires a new version of Silverlight. " & _
            "Visit the application home page to upgrade.")
    Else
        '  MessageBox.Show("2")
        ' MessageBox.Show("There is no update available.")
    End If

End Sub

Please give me any hints you might have to help me solve this.

1

There are 1 best solutions below

0
On

I got an answer that worked for me in one of the other forums. I am posting it here in case someone else has this problem:

I added these lines to my ServiceReferences.ClientConfig.

<object>
    <param name="autoUpgrade" value="true"/>
  </object>

The hint also said to sign the xap which I did but the problem didn't go away until I modified the ClientConfig.

Bob