ClickOnce Windows窗体应用程序在尝试通过CheckForDetailedUpdate()更新时抛出异常

时间:2011-01-31 18:08:22

标签: c# .net visual-studio-2008 deployment clickonce

我有一个Windows Forms ClickOnce应用程序,可以执行自己的应用程序更新。这已经好几年了,但是,最近的部署产生了以下例外:

Message: Object reference not set to an instance of an object.
Source: System.Deployment
Target Site: System.Security.Policy.ApplicationTrust RequestTrust(System.Deployment.Application.SubscriptionState, Boolean, Boolean, System.ActivationContext, System.Security.Policy.TrustManagerContext)
Stack Trace:    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.CheckForDetailedUpdate()
   at SCANit.Inventory.ClickOnce.CheckForDetailedUpdate()
   at SCANit.Inventory.AppUpdaterService.StatusOfUpdate(Boolean notify)
   at SCANit.Inventory.AppUpdaterService.PerformAppUpdate()
   at SCANitApp.MainApplication.updateMenuItem_ItemClick(Object sender, ItemClickEventArgs e)

我尝试搜索错误显示可能是由于证书过期,.pfx。但是,我生成了一个有效期很长的证书。我在先前部署的.pfx和应用程序.csproj中对Git做了一个差异,看不出真正的差异。这可能会发生什么?

1 个答案:

答案 0 :(得分:1)

道歉,我发现以前没有遇到的.csproj文件存在差异:

<PlatformTarget>x86</ PlatformTarget> 

在为应用程序更改为AnyCpu时,似乎已修复此问题。