Visual Studio-在bin文件夹中自动创建dll的引用 [英] Visual Studio - Reference of dlls are automatically created at bin folder

查看:139
本文介绍了Visual Studio-在bin文件夹中自动创建dll的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Visual Studio 2010与MCV4(单独安装)一起使用。

I am using Visual Studio 2010 with MCV4 (Installed separately).

有些dll链接到原始路径,有些dll复制到了项目中。
我不想将它们复制到项目中。

Some dlls are linked to the orignal path, and some are copied to the project. I don't want them to be copied to the project.

即在构建Web项目(MCV4-> Web API)时,我看到了几个dll,自动创建的文件:
Antlr3.Runtime.dll-在项目文件夹中创建(并且路径不是原始文件夹)。

i.e when building Web project (MCV4 -> Web API), I see several dlls, that automatically created: Antlr3.Runtime.dll - created on project folder (and path is not the original folder).

还:EntityFramework.dll,系统.Web.Optimization.dll等

also: EntityFramework.dll, System.Web.Optimization.dll and some more,

其中system.web位于C:\Program Files(x86)\参考程序集\Microsoft\Framework .NETFramework\v4.0\System.Web.dll文件夹。

where system.web is on C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll folder.

为什么将上述dll复制到项目文件夹,以及如何强制执行这些操作?

Why the above dlls are copied to the project folder, and how can I enforce that they would be on the original one?

谢谢:)

推荐答案

如果您右键单击项目中的每个引用程序集,都有一个属性 复制本地。对于您设置的每个引用,Copy Local = true都会将其复制到您的输出文件夹(\bin)。

If you rightclick each references assembly in your project there is a propery "Copy Local". For each reference you set Copy Local=true it will be copied into your output folder (\bin).

除非DLL位于GAC中(全局程序集缓存),您将需要复制它在本地,因为应用程序将不知道从何处加载这些DLL。默认情况下,当您添加引用时,如果DLL不在GAC中,则Local Local将为true。

Unless the DLL is in the GAC (Global Assembly Cache), you will want to copy it locally as the application will not know where to load these DLLs from. By default when you add a reference, Copy Local will be true when the DLL is not in the GAC.

如果应用程序找不到所需的DLL,它将失败。

If the application can not find the DLL's it needs it will fail when the DLL is needed.

.net应用程序只能从GAC或应用程序路径和子目录中加载DLL,除非您使用自己的 Assembly.Load()代码做到这一点。

A .Net application can only load DLLs from the GAC or from your application path and subdirectories unless you employ your own Assembly.Load() code to do this.

这篇关于Visual Studio-在bin文件夹中自动创建dll的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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