Question

I have a VSTO Excel Template project that is Installed/Updated by ClickOnce. If I run an automatic update it updates fine, but I would like to give the user the option of a manual update.

The problem is that executing ApplicationDeployment.CurrentDeployment.UpdateAsync (or .Update) does not result in any errors, but the deployment simply just doesn't update. The version number in Add/Remove programs stays the same, and even more unusually the ApplicationDeployment.IsNetworkDeployed flag switches to false.

Thus it seems that the only effect of running .Update is to set IsNetworkDeployed to false. The full code is a bit long, but basically it boils down to:

Private Sub ThisWorkbook_Startup() Handles Me.Startup
  Dim info As UpdateCheckInfo

    If ApplicationDeployment.IsNetworkDeployed Then
        Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
        info = AD.CheckForDetailedUpdate
        If info.UpdateAvailable Then
            AD.UpdateAsync()
        End If
    End If

End Sub
Was it helpful?

Solution

Sorry, but you have to restart Excel if you install a new version of your VSTO add-in and want it to be used. The reason for this is that when you start up Excel, it checks and finds the VSTO add-in, and copies the assembly to a shadow location. It does not run it from the ClickOnce cache. This is so if you do an update, it won't impact Office -- it will continue to run the assembly in the shadow location and you can update the version. But the new version will not load until you exit Excel and run it again, at which point it will copy the new version of the assembly to the shadow location and load it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top