开发者

Strongly naming 3rd party 2.0 .dll with VS 2010 Ilasm.exe

So, I have a 3rd party .dll written in C# 2.0 that needs to be strongly typed and I do not 开发者_运维技巧have access to the source code. I found several articles on how to disassembly the .dll and re-assembly it with a strongly named key file.

Problem I am having is that VS2010 recompiles it as a .NET 4.0 .dll instead of a 2.0 .dll (the version our application is currently in). I can't include the "new" dll in my project because it gives me a runtime error of: "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." If I don't sign the dll, I get the "assembly is not strongly typed." error.

Is there a way to recompile this .dll in the 2.0 framework using VS2010 ilasm.exe?


You are probably using the Visual Studio 2010 Command Prompt. It will setup the environment to run C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe when you type "ilasm.exe". Wrong version, you want v2.0.50727\ilasm.exe. Type the full name. Or copy and edit vc\bin\vsvarsall.bat


No, you cannot use the 4.0 ilasm to compile to 2.0; you should be using the ilasm.exe from the 2.0 framework directory; for example C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727.

Note that all you should need for this is the runtime, not the SDK or VS 2005 / 2008.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜