1

Please any one explain this. This Question helps to understand common things

Question:

What is the difference between when you 'add DLL reference from one project to another project via Browse Option and Add DLL reference from Solution project to another project and copy-paste from one project to another project'?

I have found an answer on google

Answer:

Adding a project reference adds a local project's DLL to the project that references it, and every time the solution compiles, the updated DLL for that project gets copied to the other project. So when you go through the build process, if you have 5 projects, each one rebuilds its DLL, and copies that DLL to its references.

But:

I don't know what the process is and the difference when we copy-paste from one project to another project?

Charles
  • 50,943
  • 13
  • 104
  • 142
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234

2 Answers2

3

When you do copy paste from One project to another, the dependent project add its reference of the file that you have paste in the project solution directory

When you do copy paste the dll of one project to the other project's directory and then Add its reference by browsing to that directory where you have pasted your dll. Then VS only add its reference and copy that dll to its bin folder and show you (allows you) all the method and properties that it contains.

If you do any change in your source project solution like adding or modifying methods then the updated dll of that project is not available in your dependent project solution.

So VS still points to the old dll file just because of the reference you added. So whenever you made any change in your source project solution, you have to add the reference of the updated dll to your dependent solution every time.

In Second Case: When you add reference of your source project into your dependent project solution, VS always take the most recent updated dll from your source project into your dependent project. So in this way you don't need to add reference every time you compile the code or debug.

Suhaib Janjua
  • 3,538
  • 16
  • 59
  • 73
  • 2
    I hope you like the provided solution. Don't forget to mark it as an answer. So that it may help to other developer's as well. – Suhaib Janjua Mar 06 '14 at 09:36
1

When you just reference a DLL by browsing to it, VS would copy it to the output directory of the dependent project.

Suppose afterwards that DLL is updated - there is no guaranty that VS would retake that updated DLL, and copy it again to the output directory of the dependent project - which mean, that even after you fixed some bugs in the other project, those bug would persist in the dependent project (because it is still using the previous version of that DLL).

When you add reference to other project in the solution, VS would always take the most recent and updated DLL outputted from that project.

Shlomi Borovitz
  • 1,700
  • 9
  • 9