Mixed mode assembly in .NET 4

The best would probably be to recompile your class library for .NET 4.0 in Visual Studio 2010 (ie. opening up the project, converting it, and changing the target framework.) If you can’t, or won’t, do that, then you can try adding the following to your app.config file for your .NET 4.0 application: <startup useLegacyV2RuntimeActivationPolicy=”true”> <supportedRuntime … Read more

C++/CLI Mixed Mode DLL Creation

Well, no, it doesn’t get to be mix-mode until you tell the C++/CLI compiler that your legacy DLL was written in unmanaged code. Which should have been noticeable, you should have gotten linker errors from the unmanaged DLL exports. You need to use #pragma managed: #pragma managed(push, off) #include “oldskool.h” #pragma comment(lib, “oldskool.lib”) #pragma managed(pop) … Read more