Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an application that is distributed using ClickOnce. I sign it with a certificate purchased from Thawte and have published several versions of the application. The certificate has now expired and I need to publish another version with a program fix. I have a renewed certificate but after publishing a new version with it I get an error when my application tries to update. I do not use ClickOnce automatic updates but instead check for and perform the updates in code.

I've searched a bit for some help on this matter and have found a few forums that say I'm just out of luck and there isn't a fix...but they seem to be kind of old and I was hoping that with VS 2008 perhaps this has been fixed. Does anyone know how to get around this issue?

The error that I end up with is "Object reference not set to an instance of an object." When I try to perform the .CheckForDetailedUpdate in the code I use to update my app:

       Dim updateInfo As System.Deployment.Application.UpdateCheckInfo = Nothing
       'Check if application is network deployed
       If System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed Then
           'Application is network deployed
           Dim objAppDeploy As System.Deployment.Application.ApplicationDeployment = System.Deployment.Application.ApplicationDeployment.CurrentDeployment
           'Check for updates and get update information
           Try
               updateInfo = objAppDeploy.CheckForDetailedUpdate()
           Catch ex As System.Deployment.Application.DeploymentDownloadException
               Return "Program updates for " & gblstrFormText & " cannot be downloaded at this time." & _
                      vbCrLf & "Please check your network connection and try again." & _
                      " If the problem persists, please contact support." & _
                      vbCrLf & vbCrLf & "Error: " & _
                      ex.Message
           Catch ex As InvalidOperationException
               Return "This program cannot be updated. It is likely not a ClickOnce application." & _
                      vbCrLf & vbCrLf & "Error: " & ex.Message
           Catch ex As Exception
              ' ***** THIS IS THE EXCEPTION THAT GETS HIT *******
               Return "This program cannot be updated. " & _
                      vbCrLf & vbCrLf & "Error: " &

'...rest of the code is not relevant
Posted

1 solution

I stumbled across this article:
http://msdn.microsoft.com/en-us/library/ff369721.aspx[^]

Which explains the versions of .Net that have issues with changing certificates and proposes a way to get around the issue.

Hope it helps anyone else who encounters this issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900