ClickOnce Windows Forms application throws an exception when trying to update through CheckForDetailedUpdate ()

I have a Windows Forms ClickOnce application that runs its own application updates. This has been working fine for several years, however the latest deployment raises 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 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 find the error show that this is possible because of the expired .pfx certificate. However, I generated a certificate with an expiration date. I made a difference in Git in a previous .pfx deployment and a .csproj application and I see no real differences. What could happen here?

+3
source share
1

, .csproj, :

<PlatformTarget>x86</ PlatformTarget> 

, AnyCpu .

+1

Source: https://habr.com/ru/post/1789057/


All Articles