强名称验证失败 [英] Strong Name Verification Failed

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

问题描述

我有一个小型控制台应用程序,最初是在VS 2003中的dotnet 1.1中开始的。那个

版本可以复制到运行正常的W2K3服务器上。


我在VS 2005中设置了一个新项目,并将代码文件从2003复制到了

2005,在那里编译运行,没问题。当我将两个文件(exe

& dll)复制到同一个W2K3服务器时,它们会因强名称验证而失败

失败错误。运行控制台后包含:Unhandled Exception:

System.BadImageFormatException:文件格式''x.exe无效。


我试过签署项目,即使MS建议不要这样简单的

代码,但它给出了相同的结果。我尝试了一个不同的W2K3

服务器,结果相同。


我跑了sn -v x.exe在我的XP工作站和失败的服务器上。在

两种情况下,响应是:程序集''x.exe''有效。与

dll相同,它位于带有dll的目录中。


Kal

..

I have a small console app that started out in dotnet 1.1 in VS 2003. That
version can be copied to a W2K3 server where it runs fine.

I set up a new project in VS 2005 and copied the code files from 2003 to
2005 where they compile and run, no problem. When I copy the two files (exe
& dll) to the same W2K3 server they fail with the Strong Name Verification
Failed error. After running the console contains: "Unhandled Exception:
System.BadImageFormatException: The format of the file ''x.exe is invalid.

I tried signing the project even though MS recommends against it for simple
code like this, but it gives the same result. I tried a different W2K3
server with the same result.

I ran "sn -v x.exe" on both my XP workstation and on the failing server. In
both cases the response is: Assembly ''x.exe'' is valid. The same with the
dll, which is in the directory with the dll.

Kal
..

推荐答案

更新,

在其中一台W2K3服务器上我有VS 2005,所以我设置了一个项目副本
该机器上的
。在VS下的调试模式下,项目运行。复制到执行目录的完全相同的

文件给出了相同的强名称

验证错误。


显然我遗漏了一些东西基本在这里。任何人都知道在哪里指向我

正确的方向。


Kal

" Kal" < ka*@newsgroup.nospamwrote in message

news:u6 ************** @ TK2MSFTNGP02.phx.gbl ...
Update,
On one of the W2K3 servers I have VS 2005, so I set up a copy of the project
on that machine. In debug mode under VS the project runs. The exact same
files copied to an execution directory give the same strong name
verification error.

Clearly I am missing something basic here. Anyone know where to point me in
the right direction.

Kal
"Kal" <ka*@newsgroup.nospamwrote in message
news:u6**************@TK2MSFTNGP02.phx.gbl...

>我有一个小型控制台应用程序,它始于VS 2003中的dotnet 1.1。那个

版本可以复制到运行正常的W2K3服务器上。


我在VS 2005中设置了一个新项目,并将代码文件从2003复制到了

2005,在那里编译运行,没问题。当我将两个文件

(exe

& dll)复制到同一个W2K3服务器时,它们会因强名称验证而失败

失败错误。运行控制台后包含:Unhandled Exception:

System.BadImageFormatException:文件格式''x.exe无效。


我试过签署该项目,即使MS建议反对它

简单

这样的代码,但它给出了相同的结果。我尝试了一个不同的W2K3

服务器,结果相同。


我跑了sn -v x.exe在我的XP工作站和失败的服务器上。



两种情况下,响应是:程序集''x.exe''有效。与

dll相同,它位于带有dll的目录中。


Kal



>I have a small console app that started out in dotnet 1.1 in VS 2003. That
version can be copied to a W2K3 server where it runs fine.

I set up a new project in VS 2005 and copied the code files from 2003 to
2005 where they compile and run, no problem. When I copy the two files
(exe
& dll) to the same W2K3 server they fail with the Strong Name Verification
Failed error. After running the console contains: "Unhandled Exception:
System.BadImageFormatException: The format of the file ''x.exe is invalid.

I tried signing the project even though MS recommends against it for
simple
code like this, but it gives the same result. I tried a different W2K3
server with the same result.

I ran "sn -v x.exe" on both my XP workstation and on the failing server.
In
both cases the response is: Assembly ''x.exe'' is valid. The same with the
dll, which is in the directory with the dll.

Kal
.



嗨Kal,


我无法重现您描述的问题。这是我测试的步骤:


1)使用C#在Visual Studio 2003中创建一个简单的控制台项目,使用sn创建一个

键-k mykey.snk"并使用此密钥签署项目。


2)在Visual Studio 2005中创建另一个控制台项目,复制源

文件和密钥,签署此项目使用密钥。


3)将构建的程序集复制到安装了.NET 2.0 Framework

的另一个系统,运行它并且它可以正常工作。 />

既然你已经提到另一个系统存在问题,我认为它应该可以使用你的代码重现
。您能否创建一个简单的

repro项目并在此发布或通过电子邮件发送给我?感谢您支付

您的努力。


此致,

Walter Wang(wa****@online.microsoft.com ,删除''在线。'')

Microsoft在线社区支持


================= =================================

通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。


注意:MSDN托管新闻组支持服务是针对非紧急问题

如果社区或微软支持人员在1个工作日内做出初步回复是可以接受的。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx

======================================== ==========


此帖子按原样提供。没有保证,也没有授予任何权利。

Hi Kal,

I was unable to reproduce the issue you described. Here''s my steps to test:

1) Create a simple console project in Visual Studio 2003 using C#, create a
key using "sn -k mykey.snk" and sign the project using this key.

2) Create another console project in Visual Studio 2005, copy the source
file and the key, sign this project using the key.

3) Copy the built assembly to another system which has .NET 2.0 Framework
installed, run it and it works correctly.

Since you''ve mentioned that the issue exists on another system, I think it
should be reproducible using your code. Would you please create a simple
repro project and post it here or send it to me via email? Thank you for
your effort.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove ''online.'')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


您是否有可能使用延迟签名并且已禁用检查

部件?不太可能(特别是在服务器上),但是......?
Is it possible you are using delay signing and have disabled checking for
this assembly? Unlikely (especially at the server), but...?


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

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