Question

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

Was it helpful?

Solution

Some possible directions:

  1. 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.

  2. Did the assembly get copied to the running directory of your application? Ensure that the Copy Local property of the reference is set to true.

  3. If you still don't resolve the problem, use a tools such as Fusion Log View (comes with Visual Studio, run fuslogvw.exe from 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.

OTHER TIPS

Try this:

In the project references, change the "Specific Version" property to false. Right click on the project and select Clean. Then rebuild the project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top