ClickOnce发布具有更新证书的新版本 [英] ClickOnce publish new version with updated certificate
问题描述
我有一个使用ClickOnce分发的应用程序.我用从Thawte购买的证书签名,并发布了该应用程序的多个版本.证书现已过期,我需要发布另一个带有程序修复的版本.我有一个更新的证书,但是用它发布了一个新版本后,我的应用程序尝试更新时出现错误.我不使用ClickOnce自动更新,而是使用代码检查并执行更新.
我在这个问题上搜索了一些帮助,并找到了一些论坛,说我很不走运,没有解决办法……但是它们似乎有点老了,我当时希望在VS 2008中可能已解决此问题.有谁知道如何解决这个问题?
我最终遇到的错误是对象引用未设置为对象的实例".当我尝试在代码中执行.CheckForDetailedUpdate时,我使用它来更新我的应用程序:
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
推荐答案
我偶然发现了这篇文章:
http://msdn.microsoft.com/en-us/library/ff369721.aspx [ ^ ]
解释了.Net的版本与证书更改有关的问题,并提出了解决该问题的方法.
希望它对遇到此问题的其他人有所帮助.
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.
这篇关于ClickOnce发布具有更新证书的新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!