Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Test fail to load C++ CLI assemblies

I have a C# based assembly with a class A for which I want to create some unit tests using MS Test in VS 2010. This assembly has a reference to a C++ CLI based assembly, and the class A above calls a managed class in the CLI assembly. When I try to play the test I get the following error: System.IO.FileNotFoundException: Could not load file or assembly 'XXX' or one of its dependencies. The specified module could not be found.

The unit test is inside a C# test project, and items deployment is not enabled.

All projects are configured to have a common output path, and I've checked that all assemblies are there.

like image 438
user761058 Avatar asked May 20 '26 02:05

user761058


1 Answers

  1. If it's a COM object, make sure it's registered with regsvr32

  2. make sure that all the files are copied to output directory. (Sometimes the referenced C++/CLI will be copied, but not its dependencies aka unmanaged dlls)

like image 51
Yochai Timmer Avatar answered May 22 '26 02:05

Yochai Timmer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!