Add Project Reference vs Add DLL Reference

Add Project Reference vs Add DLL Reference


First one is - Right click on project << Add Reference << Select Project in Project tab

Second one is - Right click on project << Add Reference << Select DLL in Browse tab


The correct way to do it is to add a project reference.
one of the most important differences is that a project reference is updated automatically when you change the referenced project.

for example- If you change your DAL method from GetEmployees() to GetAllEmployees() then you can use GetAllEmployees() immediately in your BL class, without compiling your DAL first. 


You typically use the project reference when the reference is part of your solution. In this way the relevant latest code is always used.

You will reference an assembly when it is a third party component or not part of your solution. This is somewhat more static as you will be using the code at the version represented by the assembly. So any changes to the assembly will require you to physically overwrite the referenced assembly with the updated dll.




作者:Angelo Lee
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
原文地址:https://www.cnblogs.com/yefengmeander/p/2887678.html