Reputation: 823
I'm making a C++/CLI wrapper for a C++ class, but the DLL created by building my C++/CLI project fails to load in C#, Assembly.Load throws a fileNotFound exception with the message "Could not load file or assembly 'CLIExport.dll' or one of its dependencies. The system cannot find the file specified."
The C++/CLI project includes only the wrapper class, the C++ class, and one header file that the C++ class depends on, for which the source and header files has been added to the solution, no references have been added. Do I need to add references to the C++ class in the C++/CLI project? I don't know what the C# app thinks the assembly is missing, and I don't know what I need to add references to, does the C++/CLI project need to have a reference to every .net type it uses like classes in the System namespace?
Thanks.
Upvotes: 2
Views: 6050
Reputation: 1189
I believe the problem is that you are trying to use unmanaged x86
dlls in a 64bit solution.
Try doing : Right click on your solution, then Configuration manager
, and set all your projects to x86
, then try building again.
Im pretty sure that your build configuration is inconsistent, therefore the error message (I ran into the same problem a few times ...)
You can read up here : What does the Visual Studio "Any CPU" target mean?
And a quick overview of the different targets in VS : http://visualstudiohacks.com/articles/visual-studio-net-platform-target-explained/
Upvotes: 1