Strong third party naming of 2.0.dll with VS 2010 Ilasm.exe

So, I have a third-party .dll written in C # 2.0, which must be strongly typed, and I do not have access to the source code. I found several articles on how to deploy a DLL and reassemble it with a strongly named key file.

The problem that I am facing is that VS2010 recompiles it as .NET 4.0.dll instead of 2.0.dll (the version that our application is now in). I can’t include the β€œnew” DLL in my project because it gives me a runtime error: β€œThis assembly is built using a runtime that is newer than the currently loaded runtime and cannot be loaded.” If I do not sign the dll, I get "the assembly is not very typed." mistake.

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

+8
c # visual-studio-2010 ilasm
source share
2 answers

You are probably using the Visual Studio 2010 command prompt. It will set the environment to run C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ ilasm.exe when you enter "ilasm.exe". Invalid version, you want v2.0.50727 \ ilasm.exe. Enter the full name. Or copy and edit vc \ bin \ vsvarsall.bat

+13
source share

No, you cannot use 4.0 ilasm to compile to 2.0; You must use ilasm.exe from the 2.0 framework directory; e.g. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 .

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

+1
source share

All Articles