How can I remove all traces of a ClickOnce application from a customer's computer?

前端 未结 5 1683
孤独总比滥情好
孤独总比滥情好 2020-12-17 01:41

I have a ClickOnce application that about 120 customers are using. This week, I found out two customers declined an update in January and were stuck on an old version. I dis

5条回答
  •  一整个雨季
    2020-12-17 02:12

    If you've already run the uninstall and it hasn't sorted it, try deleting the files in

    C:\Documents and Settings\\Application Data\
    

    You'll have to do some looking around to find your application, but it shouldn't be too hard.

    In the past I've used the below code to avoid the users having to click the update button, this will install it without them even knowing.

    Private Shared Function UpdatedApp(ByVal AppLog As Logger) As Boolean
    
        Try
            ' Check to see that this program has been delpoyed
            If Deployment.Application.ApplicationDeployment.IsNetworkDeployed Then
                Dim CurrApp As System.Deployment.Application.ApplicationDeployment = System.Deployment.Application.ApplicationDeployment.CurrentDeployment
    
                AppLog.WriteLine("Application Version : {0}", CurrApp.CurrentVersion)
                AppLog.WriteLine("Checking for updates")
    
                ' If theres a update then Install it
                If CurrApp.CheckForUpdate() Then
                    AppLog.WriteLine("An updated version is available. This update will now be applied.")
    
                    ' Update the app to the current version
                    CurrApp.Update()
    
                    ' Upgrade the settings (that is, the connection string).
                    My.Settings.Upgrade()
    
                    AppLog.WriteLine("Version {0} is now installed, the application will now restart", CurrApp.UpdatedVersion)
    
                    Return True
                End If
            Else
                AppLog.WriteLine("Application version: *Dev Version*")
            End If
        Catch ex As Exception
            AppLog.WriteLine("The application is unable to check for updates. The program will execute on a possibly outdated version. Error {0}", ex.ToString)
        End Try
    
        ' Always return false unless the update has been applied (even if the update throws an error)
        Return False
    End Function
    

提交回复
热议问题