In Visual Studio 2010, I've written a C++/CLI managed class wrapper for an external library provided as a .lib file, lets call it ExternalLibrary.lib. The .lib is included as a dependency of the project, and no warnings or errors are issued on compilation.
When I attempt to use this wrapper project by including it as a dependency of a C# project, I get the following error when I run in debug mode (project silently fails to run without debugging):
FileNotFoundException was unhandled
Could not load file or assembly 'WrapperProject.dll' or one of its dependencies.
The specified module could not be found
I verified that WrapperProject.dll is in the debug folder of the C# project, so I decided to check its dependencies using Dependency Walker (http://dependencywalker.com/) The first dependency on the list was "ExternalLibrary.dll". I think this is the problem, because "ExternalLibrary.dll" never existed, only "ExternalLibrary.lib." How do I tell Visual Studio to not require the non-existent DLL, and instead incorporate the .lib file?
It already throws an error if I remove the .lib from the linker path, so it's looking for and finding the file; I'm not sure why at the end it would add a dependenency on a non-existent .dll.
Thanks
You can't - the DLL will always be required. The .LIB file is the import library for that DLL.
Linking against the .lib file just tells the compiler how to load the proper information from the corresponding .DLL (ExternalLibrary.dll) at runtime. The .DLL is still required, and will need to be deployed along with your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With