【发布时间】:2011-01-06 17:05:05
【问题描述】:
在 Visual Studio 中,我有一个包含多个项目的解决方案。在一个项目中,我添加了对另一个项目的引用。一切都好。我可以在自动完成等中看到另一个项目的命名空间/类。
当我尝试做的时候
OtherProjectNamespace.Class a = new OtherProjectNamespace.Class();
我明白了:
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.
没有行,什么都没有,我试过 try...catch around the new line,甚至没有捕捉到异常。
可能是什么原因?
谢谢, 卡洛斯
【问题讨论】:
-
你添加了对其他项目的引用吗?
-
是的,我正在另一个线程中尝试实例化......以防万一。
-
你是怎么添加引用的,是文件的副本,还是解决方案的输出。听起来您只有一个副本,并且文件已被删除,请尝试确认引用是否正确。
-
嘿,我刚刚添加了对另一个项目的引用(不是使用 dll 的项目,有 4 个项目)并且它起作用了。也许是因为我使用反射来加载 dll 等,然后创建一个线程来工作。这个问题我该怎么办?
标签: c# dll filenotfoundexception