Reputation: 21
I have a some managed C++ assembly with simple code.
This assembly has mixed (managed/unmanaged) code. If I put unmanaged code to the separate unmanaged static library and link it with managed code then I get registration error like this: "Failed to load 'xxxxxx.dll' because it is not a valid .NET assembly".
If I put all code to one project and build it together then all works finely. I have tried it on VS2008 + .NET3.5 + RegAsm .Net2.0. My assembly is signed.
I would like to save my code separation for unmanaged static library and managed assembly.
What I need to do?
Thanks in advance.
Upvotes: 2
Views: 2119
Reputation: 89162
Your lib must be built to use the C++ runtime dynamically (as of .NET 2.0).
In project properties, open C/C++, and go to Code Generation. Look for Runtime Library, and set to Multi-threaded DLL for release, and Multi-threaded Debug DLL for debug.
Upvotes: 1