开发者

FileNotFoundException when using dll method

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

开发者_Python百科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:

  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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜