Including in a Visual Studio 2005 project a DLL built with Visual Studio 2010
-
22-03-2021 - |
Question
I have a dll library built in Visual Studio 2010, but I need to include it in a VS 2005 project.
If I do it, I get the error message
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I googled the error message, but the only workaround I found is to replace gacutil.exe
located in C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
with the gacutil.exe
located in C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools
.
I tried this way, but I'm still getting the same error.
Solution
You need to check which .NET framework the DLLs are aimed at.
You'll find that by default 2010 will be aimed at .NET 4.0 and 2005 will probably be .NET 3.0.
You can reference a .NET 3.0 library from .NET 4.0 code but not the otherway around.