none
How to Add the DLLs into seperate folder instead of bin folder through c# code. RRS feed

  • Question

  • I have a simple web application for demo, in that while we run app or build, I have to load the dll files into my customized folder name newbin instead of bin folder. I got the solution by changing Output Path property of project and by using making some changes in web.config file setting probin private path=folder name. I wanted to load those dll into seperate folder through c# code only. Is it possible if yes plz provide me some hints.

    Thank You.


    • Edited by Taufeeque Tuesday, October 22, 2019 7:05 AM
    Tuesday, October 22, 2019 6:51 AM

All replies

  • IMO, the DLL(s) need to be in the Bin folder or GAC in order for .NET to be able to find the DLL(s).
    Tuesday, October 22, 2019 8:38 AM
  • Ya, but i want it to be loaded in custom folder called newbin, how can i get that, i am not getting any reference or clue. If u know plz let me know.

    Thank you.

    Tuesday, October 22, 2019 10:56 AM
  • There's no predefined way to do this since this not the (usual) way to do it. If your WebApp uses a DLL/Project (via references) this reference is added to the bin folder. If you 'just' add an existing DLL o yur project you can add ist to a 'newbin' folder within your project and define it to be copied to output.

    If you reference a nuget package, you can define target directories ist the package itself. So building a nuget package from your DLL project could be a possible solution.

    Tuesday, October 22, 2019 11:18 AM
  • Ya, but i want it to be loaded in custom folder called newbin, how can i get that, i am not getting any reference or clue. If u know plz let me know.

    Thank you.

    I have never seen this, and I think it's a waste of time. I have seen DLL(s) segregated in a code repository like TFS for an application. But all the DLL(s) wound-up in the Bin folder when the application was deployed. 
    Tuesday, October 22, 2019 12:11 PM
  • Ok Chris Thank u, will check.
    • Edited by Taufeeque Tuesday, October 22, 2019 12:35 PM
    Tuesday, October 22, 2019 12:35 PM
  • k, Thank u DA924x.

    Tuesday, October 22, 2019 12:36 PM
  • Personally I don't see breaking from the norm wise unless there is a very compelling reasons. For the record use the following

    https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/specify-assembly-location#using-the-probing-element


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, October 22, 2019 4:56 PM
    Moderator