简体   繁体   中英

Including in a Visual Studio 2005 project a DLL built with Visual Studio 2010

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM