C# – dll libraries stored in VS .Net

cdllshared-libraries

I wonder where dll files are stored in Visual Studio and whether its the best way to keep them there or consolidate elsewhere for the following cases:

1) My solution includes a c# library project which other projects in the same solution reference to. My understanding is that the library project stores the dll in its own directory /bin folder. So do I need to establish the reference to that library by pointing to the dll in that external folder? Problem is that this dll should later be shipped with the projects referencing to the dll file. Will the projects who reference to the dll file create a copy of the dll in their own project /bin folders or how does it work?

2) where should I copy external libraries to that are referenced by projects I like to ship in compiled fashion? Should a dll be copies and referenced to into each project's bin folder that utilizes such external library?

I am a bit confused by how going practice is and could not find straightforward answers in other posts here.

Thanks

Best Answer

If you can set two solutions one for your dll referenced and another for your project that reference them after

  1. create a dependencies folder where you will set all binaries that are dll you need
  2. set path to this dependencies folder on all your projects that will create dll you want to reference
  3. set build order on your solution to first build your dll and after build your project that reference your dll

when you deploy it, make sure that you create dependencies folder

For your information, your application first see on GAC folder (windows\assembly), after see on your current path, and after use PATH environment variable.