views:

268

answers:

2

Hello,

I have an assembly containing a mixture of Managed and unmanaged C++ code. I have signed it and installed into Global Assembly Cache. My program (.Net, C#) won't find it there, although it worked perfectly well when the assembly was in the program directory. The program uses DllImport and pinvoke to call the methods from the assembly. How can I make the program find my assembly in the GAC? Can I use exe.config or exe.manifest file to achieve this?

+2  A: 

No you can't. The way DllImport resolves libraries is completely different from they way runtime finds managed assemblies.

Mehrdad Afshari
A: 

Marcus Heege has a nice blog post about it. You need to add /assemblylinkreference when you are linking your C++/CLI code

http://www.heege.net/blog/PermaLink,guid,d3b405c1-73d4-4d04-934f-3e2ee2b5f589.aspx

Filip
Filip, thank you for your post. The blog is indeed very interesting. But what I want to achieve is calling the mixed mode assembly without using managed wrapper installed in GAC.
jimmyjoe