Search code examples
c#c++asp.netdlldll-reference

Difference Between DLL Reference's? And Uses?


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?


Solution

  • 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.