in Visual Studio I have a solution with several projects. In one project I added a reference to another project. All fine. I can see the namespaces/classes of the another project in autocomplete, etc.
When I try to do
OtherProjectNamespace.Class a = new OtherProjectNamespace.Class();
I’m getting this:
Could not load file or assembly '**OtherProjectNamespace**, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
There is no line, nothing, I tried try… catch around the new line and is not even catching the exception.
What could be the cause?
Thanks,
Carlos
Some possible directions:
Does the class you are trying to create have any dependency on a class in another assembly? If it does, try adding a reference to the third assembly.
Did the assembly get copied to the running directory of your application? Ensure that the
Copy Localproperty of the reference is set totrue.If you still don’t resolve the problem, use a tools such as Fusion Log View (comes with Visual Studio, run
fuslogvw.exefrom VS command line) to get the exact name of the file that was missing, and the locations from which the CLR tried to load it. Maybe this way you’ll find another file that you need to copy.