开发者

ClickOnce Windows Forms application is throwing an exception on attempt to update via CheckForDetailedUpdate()

I have a Windows Forms ClickOnce application that performs its own application updates. This has been working fine for several years, however, a recent deployment is producing the following exception:

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 开发者_StackOverflow社区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)

My attempts to search the error reveals it's possibly due to an expired certificate, .pfx. However, I generated a certificate with a long expiry date. I did a diff in Git on the previous deployment's .pfx and application .csproj and see no real differences. What might be happening here?


My apologies, I found a difference in the .csproj file I did not catch before:

<PlatformTarget>x86</ PlatformTarget> 

This seems to have fixed it when changing to AnyCpu for the application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜