引用的相关性不会复制到输出目录 [英] Dependencies of references not copied to output directory

查看:318
本文介绍了引用的相关性不会复制到输出目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CommonUtils LIB我已经内置到我的文件引用的我的几个项目的DLL。 CommonUtils取决于log4net.dll将其设定为文件参考并复制本地=真时CommonUtils.dll建成。 log4net.dll和CommonUtils.dll不在GAC。

I have a CommonUtils lib I have built into a dll which I file reference from several of my projects. CommonUtils depends on log4net.dll which was set as a file reference and copy-local=true when CommonUtils.dll was built. log4net.dll and CommonUtils.dll are not in GAC.

一切工作正常,在MyWorkingProject,我只是有一个文件引用CommonUtils.dll - log4net.dll显示在输出目录(因为它是CommonUtils.dll的依赖,但来自MyWorkingProject未引用)。 但是,如果我创建一个新的项目添加一些单元测试:MyWorkingProjectTest和项目参考MyWorkingProject然后文件参考CommonUtils.dll在这里再次(我想用一些CommonUtils的),那么在构建log4net.dll这是一个依赖于这两个项目引用和参考文件,以及不被复制到输出目录。

Everything works fine in MyWorkingProject where I only have a file reference to CommonUtils.dll - log4net.dll shows up in the output directory (as it is a dependency of CommonUtils.dll but not referenced from MyWorkingProject). However if I create a new project to add some unittests: MyWorkingProjectTest and project reference MyWorkingProject and then file reference CommonUtils.dll again here (I want to use some of the CommonUtils) then upon building log4net.dll which is a dependency in both the project reference and in the file reference as well does not get copied to the output directory.

谁能弄清楚这里发生了什么?该编译器不知道哪个log4net.dll文件,它应该抓住?难道有什么我做错了什么?我应该在一些其他的方式做到这一点的log4net.dll得到明确的复制? 这有什么意义,我要明确地参考log4net的不是吗?

Can anyone clarify what is happening here? Does the compiler not know which of the log4net.dll files it should grab? Is there something I am doing wrong here? Should I do this in some other way for the log4net.dll to get copied explicitly? Does it make any sense that I have to explicitly reference log4net does it?

推荐答案

这是设计使然。你需要考虑的影响,提及自动继承会导致。虽然你可以在逻辑上看到的参考资料是应该的,不存在这样的划分编译器。你可以,理论上,最终再现框架和您的操作系统的很大一部分,如果它走在整个依赖关系树。

This is by design. You need to think about the implications that automatic inheritance of references would cause. While you can logically see what the references should be, there is no such delineation to the compiler. You could, theoretically, end up reproducing the Framework and a good part of your OS if it walked the entire dependency tree.

这肯定是一个痛苦的,我同意和理解你的无奈,但我认为微软不能够找到其他方式做一个合乎逻辑的方式。

It definitely is a pain, and I agree with and understand your frustration, but I assume that Microsoft was not able to find a logical way to do this otherwise.

这篇关于引用的相关性不会复制到输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆