Search code examples
c#.netvisual-studiodll.net-assembly

Where to copy a 3rd party assembly in your Visual Studio project?


My operating system is Widows 7. I am using Visual Studio 2015.

I have a solution Sln1 which has 2 projects Proj1 and Proj2 both projects are of Class Library type.

In Windows Explorer I can see:

  • I have a folder c:\MyWork\Sln1 which has the solution file named Sln1.sln and it also has 2 folders named Proj1 and Proj2.

  • I have a folder c:\MyWork\Sln1\Proj1 which has the project file named
    Proj1.csproj and it also has 3 folders named bin, obj and Properties.

  • I have a folder c:\MyWork\Sln1\Proj2 which has the project file named
    Proj2.csproj and it also has 3 folders named bin, obj and Properties.

I have a 3rd party assembly (Telerik.Web.UI.dll) which is in folder C:\Program Files (x86)\Telerik\UI for ASP.NET AJAX Q3 2015\Bin45.

I want to use this 3rd party assembly in the source code of Proj2 only. But I dont want the project Proj2 to access it from its current location. Instead I want the project Proj2 to have its own copy of this 3rd party assembly. How can I do that?


Solution

  • Copy the dll file to the desired location for example (solution/project/lib). Then in vs2015 open the solution explorer Ctrl + Alt + L.

    Then under the project, you want to add the lib to right-click on reference. enter image description here

    Then click on add reference. Go to the browse tab and in the right bottom side click on browse. enter image description here

    Here you can select the dll you want to reference in the project. The 3th party library is now ready to use in your project.