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?
In my case my code on Initialize and Form_Load contained calls to another project depending on DLL references. By excluding this code with
if (!DesignMode)
{
//add your initializing code (for runtime!) here
}
I was able to add the control on design time.
HTH
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