views:

143

answers:

4

Problem: I have a WinForms control ('MyControl') with a dependency on myCli.dll, a dll written in C++ CLI. This component is third party (written by another team). myCli.dll has a dependency on myLibrary.dll which is written by yet another party. The control lives in myAssembly.dll, which is a C# controls and resources library.

I had this control working great when myCli.dll didn't have a dependency on myLibrary.dll. I could add it to forms, build it, and so on. But the new version of myCli.dll came out and I relinked against it. Suddenly, the IDE is behaving badly. The key issue appears to be that the IDE is unable to resolve the myCli.dll dependency on myLibrary.dll.

When I attempt to drag the control from the toolbox to a design surface, I get the error "Failed to create component 'MyControl'. The error message follows: 'System.IO.FileNotFoundException: Could not load file or assembly 'myCli.dll, Version 0.0.0.0, Culture=neutral, PublicKeyToken=2fb8da784abc560a' or one of its dependencies. The system cannot find the file specified"

My belief is that if I can figure out where to put myLibrary.dll, I will resolve the reference issue. I don't know this for sure. Does someone know what I should do to resolve the issue?

A: 

I think the DLL needs to go into the project directory, then set it to be copied to the output directory on build.

Clippit '98
I tried that. it didn't work
MedicineMan
A: 

For designer support, I think the myLibrary.dll must either go into C:\Program Files\Visual Studio xxx\Common7\IDE\PublicAssemblies (assuming that myCLI.dll also lives there), or to the place where myCLI.dll exists or you might try copying it to C:\Windows\System32 - the system should be able to find it then.

Make sure to add it to the project as well and set it to "Copy always" as suggested by Clippit '98.

Thorsten Dittmar
A: 

Another way to find the proper place would maybe the usage of Process Monitor. Just filter the output for your dll and check in which paths it searches for the file.

Oliver
A: 

myCli.dll and all its dependencies need to be in the exact same folder, otherwise VS will not be able to find them.

The easiest way you could do this, is make sure that when it builds myCli.dll, it copies all the files to the Debug/Release folders, and then just reference those controls in your project from the Debug/Release folders directly.

Marineio