visual-studio 视觉工作室复制本地

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3167395/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:11:45  来源:igfitidea点击:

visual studio copy local

c#.netasp.netvisual-studio

提问by RJ.

In visual studio, when you add a reference there is a flag in the properties called, "Copy Local". There is some confusion about what this actually does and when. It seems easy to understand but my question is when does it copy local. Is it when the reference is added or does it copy the dll locally when the project is built.

在 Visual Studio 中,当您添加引用时,属性中有一个名为“Copy Local”的标志。关于这实际上做什么以及何时执行存在一些混淆。这似乎很容易理解,但我的问题是它何时复制本地。是在添加引用时还是在构建项目时在本地复制dll。

The reason for this question is we have created a asp.net template file that refences a dll that is on all of our devs local workstations in exactly the same place. We thought that by setting the flag to "Copy Local", this would reference the location where the dll lives but when we use the template, the reference is broken and needs to be re-added.

这个问题的原因是我们创建了一个 asp.net 模板文件,该文件引用了我们所有开发人员本地工作站上完全相同位置的 dll。我们认为通过将标志设置为“复制本地”,这将引用 dll 所在的位置,但是当我们使用模板时,引用已损坏,需要重新添加。

Can anyone shed some light on this?

任何人都可以对此有所了解吗?

采纳答案by lornova

The Copy Local property determines whether a reference is copied to the local bin path. At run time, a reference must exist in either the Global Assembly Cache (GAC) or the output path of the project. If this property is set to true, the reference is copied to the output path of the project at run time.

Copy Local 属性确定是否将引用复制到本地 bin 路径。在运行时,引用必须存在于全局程序集缓存 (GAC) 或项目的输出路径中。如果此属性设置为 true,则在运行时将引用复制到项目的输出路径。

So this property is actually not useful in your scenario.

所以这个属性在你的场景中实际上没有用。

I'm unable to suggest a better solution than adding the assembly to the GAC in each developer workstation: http://msdn.microsoft.com/en-us/library/yf1d93sz.aspx

我无法提出比在每个开发人员工作站中将程序集添加到 GAC 更好的解决方案:http: //msdn.microsoft.com/en-us/library/yf1d93sz.aspx