[英]DLL reference not copying into project bin
Project A references Project B , and Project B references an external DDL (restored using NuGet). 项目A引用项目B , 项目B引用外部DDL(使用NuGet恢复)。 The DLL should get copied into Project A 's bin folder (along with Project B 's DLL): DLL应该被复制到Project A的bin文件夹(以及Project B的DLL):
In my case, when running Project A , I get the following exception thrown: 在我的例子中,当运行项目A时 ,我得到以下异常抛出:
Could not load file or assembly 'PostSharp, Version=3.2.18.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' or one of its dependencies. 无法加载文件或程序集'PostSharp,Version = 3.2.18.0,Culture = neutral,PublicKeyToken = b13fd38b8f9c99d7'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。
The DLL is not being copied into Project A 's bin. DLL未被复制到项目A的bin中。 All other external references from Project B are being copied across just fine, which is what is confusing for me. 项目B中的所有其他外部引用都被正确复制,这对我来说很困惑。
Copy Local
is set to true for all references involved. 对于所涉及的所有引用, Copy Local
都设置为true。 Example: 例:
How do I do this? 我该怎么做呢?
Note: Using Visual Studio 2013. 注意:使用Visual Studio 2013。
The options that I found were to: 我找到的选项是:
I don't like any of the above solutions. 我不喜欢上述任何解决方案。 They are hacks in my opinion and will only make for a more unmaintainable solution in the long run. 在我看来,它们是黑客攻击,从长远来看,只能制定一个更难以维护的解决方案。
I have fixed the problem by using a common output directory. 我已经通过使用公共输出目录修复了该问题。 This seems to be a recommended solution by many. 这似乎是许多人推荐的解决方案。 I have also experienced much faster build times. 我也经历了更快的构建时间。 See this Stackoverflow post . 请参阅此Stackoverflow帖子 。
当我遇到这个问题时,这是因为我更改了项目的名称,但没有更改程序集名称 - 它与解决方案中另一个项目的程序集名称相同。
I've added some dummy (unused) code on Project B, making reference to the DLL needed. 我在Project B上添加了一些虚拟(未使用)代码,引用了所需的DLL。
Thus, the compiler will guess that it must copy the DLL into project A output. 因此,编译器会猜测它必须将DLL复制到项目A输出中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.