office加载项部署清单签名的证书或其位置不受信任

时间:2024-01-30 08:46:00

异常信息:

System.Security.SecurityException: 此应用程序中的自定义功能将不起作用,原因是用于为 BIMT写作指导 的部署清单签名的证书或其位置不受信任。请向管理员寻求进一步帮助。
在 Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInTrustEvaluator.VerifyTrustPromptKeyInternal(ClickOnceTrustPromptKeyValue promptKeyValue, DeploymentSignatureInformation signatureInformation, String productName, TrustStatus status)
在 Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInTrustEvaluator.VerifyTrustUsingPromptKey(Uri manifest, DeploymentSignatureInformation signatureInformation, String productName, TrustStatus status)
在 Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInTrustEvaluator.VerifyTrustUsingPromptKey(Uri manifest, DeploymentSignatureInformation signatureInformation, String productName)
在 Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.ProcessSHA1Manifest(ActivationContext context, DeploymentSignatureInformation signatureInformation, PermissionSet permissionsRequested, Uri manifest, ManifestSignatureInformationCollection signatures, AddInInstallationStatus installState)
在 Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.VerifySecurity(ActivationContext context, Uri manifest, AddInInstallationStatus installState)
在 Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()
失败的程序集的区域是:
MyComputer

异常截图:

结觉方案:

 1  private void button1_Click(object sender, EventArgs e)
 2         {
 3             try//32位
 4             {
 5                 Microsoft.Win32.RegistryKey key;
 6                 key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\MICROSOFT\.NETFramework\Security\TrustManager\PromptingLevel");
 7 
 8                 key.SetValue("MyComputer", "Enabled");
 9                 key.SetValue("LocalIntranet", "Enabled");
10                 key.SetValue("Internet", "Enabled");
11                 key.SetValue("TrustedSites", "Enabled");
12                 key.SetValue("UntrustedSites", "Enabled");
13                 key.Close();
14                 MessageBox.Show("Security Reg Done!");
15             }
16             catch (Exception ex)
17             {
18                 MessageBox.Show(ex.Message);
19             }
20         }
21 
22         private void button2_Click(object sender, EventArgs e)
23         {
24             try//64位
25             {
26                 Microsoft.Win32.RegistryKey key;
27                 key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Wow6432Node\MICROSOFT\.NETFramework\Security\TrustManager\PromptingLevel");
28 
29                 key.SetValue("MyComputer", "Enabled");
30                 key.SetValue("LocalIntranet", "Enabled");
31                 key.SetValue("Internet", "Enabled");
32                 key.SetValue("TrustedSites", "Enabled");
33                 key.SetValue("UntrustedSites", "Enabled");
34                 key.Close();
35                 MessageBox.Show("Security Reg Done!");
36             }
37             catch (Exception ex)
38             {
39                 MessageBox.Show(ex.Message);
40             }
41         }

软件下载地址:http://pan.baidu.com/s/1jH3Rc1o

msdn说明:https://msdn.microsoft.com/zh-cn/library/ms996418.aspx