user1254965
user1254965

Reputation: 21

Loading Assemby failed with FileNotFoundException - Fusion says all ok

I have an assembly with C++/CLI code that I want to reference in my unit test project. MSTest says:

Test method  Grafik.Implementation.Tests.MappingHelperTests.GetMappedFeatures_OneMappedFeature_OneFeatureReturned threw exception: 
System.IO.FileNotFoundException: Die Datei oder Assembly "Graphic.Interface.Managed.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Das angegebene Modul wurde nicht gefunden.

I activated the Fusion Assembly-Binder protocol. And this says the binding was ok:

LOG: Die Bindung war erfolgreich. Assembly wird zurückgegeben von C:\xyz\Grafik.Tests\bin\x86\Debug\Graphic.Interface.Managed.dll.
LOG: Die Assembly wird im default-Load-Kontext geladen.

Does anyone know what's wrong here? Platform is x86. Thanks in advance!

Upvotes: 2

Views: 417

Answers (1)

Andreas H.
Andreas H.

Reputation: 11

Most probably, your assembly links to some DLL which cannot be found in the search path. If the C++/CLI code contains "additional dependencies", the corresponding DLLs must be copied to the output path of your unit test project which references the assembly with the C++/CLI code.

Look into the project properties of your C++/CLI project which is referenced by your unit test project. Go to the "Linker/Input" properties. If there are LIB files listed under "Additional dependencies", make sure the according DLLs are present in the output path of your unit test project.

Unfortunately, the fusion assembly binder protocol still reports the assembly to be loaded successfully if C++ libraries referenced from there cannot be loaded.

Upvotes: 1

Related Questions