简体   繁体   English

是否有任何理由将DLL添加到您的/ bin目录,但不添加对它的引用?

[英]Is there any reason to add a DLL to your /bin directory, but not add a reference to it?

I understand that adding a reference to an assembly from a project makes the namespaces/types/classes of the referenced assembly available to your code. 我知道,从项目中添加对程序集的引用会使所引用程序集的名称空间/类型/类可用于您的代码。 But would there ever be a reason why you'd add an assembly to your /bin, but not need to add a reference to it from your project? 但是,是否有理由将程序集添加到/ bin中,而又不需要从项目中添加对它的引用呢?

I mean is the DLL all but useless until a reference is added? 我的意思是在添加引用之前DLL几乎没有用吗?

Not at all. 一点也不。 Reflection allows to load an assembly at runtime without any prior reference. 反射允许在运行时加载程序集,而无需任何事先参考。 Think how this is useful in a plugin architecture 考虑一下这在插件体系结构中如何有用

If you're building ASP Web Site than you just place the dll's in the bin. 如果您要构建ASP网站,则只需将dll放入垃圾箱即可。

if you're creating an ASP Web Application, then you need to add it as a reference. 如果要创建ASP Web应用程序,则需要将其添加为参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM