Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Certification expiration & programmatic updates
 

Certification expiration & programmatic updates

In short, I get an exception when trying to upgrade a click-once application after having published a new version with a new certificate.

Here's the background:

I'm about to create a WPF application (.NET Framework 3.5) which will be distributed using ClickOnce. Each customer using the software will place the ClickOnce application on an IIS in their network, and then install it on a couple of PC's. The PCs does normally not have a keyboard or a mouse connected to them. During the initial installation, a sysadmin will connect a mouse to the PC and install the software. The people using the PC's aren't "trusted" - they are not expected to install / upgrade software on the computers. Hence, I must do the update of the application programatically and can't rely on the built-in ClickOnce-upgrade check during/after start-up.

Problem:
I created a simple WPF application which I published. This test application calls ApplicationDeployment.CurrentDeployment.CheckForUpdate() to initiate an update. This works fine - until I publish a new version of my software with a new certificate. If I sign my application using another certificate and publish it, calling CheckForUpdate on an already deployed versionwill trigger a "Object reference not set to an instance of an object"-error. At first I assumed this was an error in my code, but when looking at the exception stack trace, I see that it's thrown within the System.Deployment-namespace, more precisly at:

at System.Deployment.Application.ApplicationTrust.RequestTrust(SubscriptionState subState, Boolean isShellVisible, Boolean isUpdate, ActivationContext actCtx, TrustManagerContext tmc)
at System.Deployment.Application.DeploymentManager.DetermineTrustCore(Boolean blocking, TrustParams tp)
at System.Deployment.Application.DeploymentManager.DetermineTrust(TrustParams trustParams)
at System.Deployment.Application.ApplicationDeployment.CheckForDetailedUpdate(Boolean persistUpdateCheckResult)
at System.Deployment.Application.ApplicationDeployment.CheckForUpdate()
at WpfApplication1.Window1.button2_Click(Object sender, RoutedEventArgs e)

Questions:

  1. I can't recall having seen anything under the System-namespace throw a System.NullReferenceException before. Why would CheckForUpdate throw this exception just because the certificate of the new application has changed?
  2. I want to use a purchased certificate (not a self-signed / <project>_TemporaryKey.pfx-certificate). After 1-3 years,this purchased certificate will expire and I will run into the problem above. Is there a workaround to this? I did not experience any exception when relying on the built-in ClickOnce update-check but remember that my application must not require any user interaction, so I can't do it that way. I also understand that CA's such as Verisign and Thawte won't set the expiry date more than 1-3 years into the future.

I understand that these question may have been posted here before. In particular, I've read the following information on the subject. However, it's not clear to me whether some of the statements made in them relate to updates made using ApplicationDeployment.CurrentDeployment.UpdateAsync(); or the built in ClickOnce-update

  • Edited byNitramafve Wednesday, September 16, 2009 3:07 PM
  •  
Nitramafve  Monday, September 14, 2009 11:27 AM
Sorry to tell you this, but when doing programmatic updates, when you update your certificate, your users will all have to uninstall and reinstall the application.

RobinDotNet
Click here to visit my ClickOnce blog!
  • Marked As Answer byNitramafve Wednesday, September 16, 2009 9:09 AM
  •  
RobinDotNet  Monday, September 14, 2009 9:20 PM
Sorry to tell you this, but when doing programmatic updates, when you update your certificate, your users will all have to uninstall and reinstall the application.

RobinDotNet
Click here to visit my ClickOnce blog!
  • Marked As Answer byNitramafve Wednesday, September 16, 2009 9:09 AM
  •  
RobinDotNet  Monday, September 14, 2009 9:20 PM
Thanks for the concise answer.

Nitramafve  Wednesday, September 16, 2009 9:09 AM
If it makes you feel any better, they have fixed this in .NET 4.0, which is out in Beta, but not due out as RTM until next year.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Friday, September 25, 2009 3:33 AM

You can use google to search for other answers

Custom Search

More Threads

• Installer package
• VS2005 Bootstrapper: Shared License Agreement
• Clickonce not autoupdating
• Locating the Path to a ClickOnce Executable
• New user cant install app after I have posted updates?
• Changing Web service URLs stored in User Settings in Clickonce
• ClickOnce Downloading and installing 3.5 framework on users' computer
• redistributing MDAC 2.8 as prerequisite
• Do user app settings get overwritten when using clickonce deployement
• Does deployment server need to be Framework 2.0?