申请强名验证失败 [英] Strong name validation failed for application

查看:81
本文介绍了申请强名验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个使用C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ WindowsPowerShell \ 3.0 \ System.Management.Automation.dll的C#应用​​程序

I made a c# application that uses C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0\System.Management.Automation.dll

我还将dll复制到了我的bin文件夹中.它工作正常,但是如果我将bin文件夹复制到另一台计算机并运行可执行文件,则会出现此错误:

I also copied the dll to my bin folder. It works fine, but if I copy the bin folder to another machine and run the executable I get this error:

************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

注意:我根本不对程序集签名.另外,我也不想通过修改注册表项来禁用安全性.我只想适当地修复它.任何想法如何在不全局注册dll的情况下解决此问题?

Note: I'm not signing the assemblies at all. Also I do not want to disable security by modifying the registry keys. I just want to fix it properly. Any ideas how to fix this problem without globally registering the dll?

更新:我尝试将整个Visual Studio项目复制到另一台计算机上.在Windows 8上运行时,它无法在Windows 7上运行.

Updates: I tried copying the whole visual studio project over to the other machine. It's not working on windows 7 while it is working on windows 8.

推荐答案

您可以通过更改

System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

System.Management.Automation

但是我建议使用 Fuslogvw (可以将其与支持dll一起复制到目标服务器上).

But I would suggest getting more information about exactly what is wrong, using Fuslogvw (which can be copied onto your destination server, along with a support dll).

这将向您确切显示应用程序在哪里检测dll以及导致问题的原因.也许您需要将另一个dll添加到bin文件夹中,或者GAC会在另一个dll上胜出.

This will show you exactly where the application is probing for dll's and what is causing the issue. Maybe you have another dll you need to add to your bin folder, or maybe the GAC is winning out on another dll.

这篇关于申请强名验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆