none
Multiple Projects using the same DLL Question RRS feed

  • Question

  • Hello, I have multiple projects that share the same one DLL reference. I don't mind adding the dll each time, but when I deploy my multiple programs, each directory contains that dll, call it MyReference.dll. For instance:

    Project 1 folder - exe and the MyReference.dll
    Project 2 folder - exe and the same MyReference.dll
    Project 3 folder - exe and the same MyReference.dll
    Etc. 

    Anyway I can do when I deploy my project files on another PC, I don't need to deploy MyReference.dll every time? Something like have it in a central location, and then whenever I deploy my project files all I have to worry is the exe file? 

    Wednesday, August 21, 2019 3:25 PM

Answers

  •  Something like have it in a central location [...] 

    Your "central location" is called Global Assembly Cache (GAC).

    You can install a DLL manually into the GAC with the command "GACUTIL -i name.dll". However, you will normally do this only for testing. When you deploy your application, you will let the installer install the DLL into the GAC. Most installer tools know how to do this.

    Once the DLL is in the GAC, all your EXEs will be able to find it.

    The DLL needs a Strong Name before it can be deployed to the GAC. Visual Studio can apply the Strong Name if you configure it from the project properties.

    Wednesday, August 21, 2019 3:37 PM
    Moderator

All replies

  •  Something like have it in a central location [...] 

    Your "central location" is called Global Assembly Cache (GAC).

    You can install a DLL manually into the GAC with the command "GACUTIL -i name.dll". However, you will normally do this only for testing. When you deploy your application, you will let the installer install the DLL into the GAC. Most installer tools know how to do this.

    Once the DLL is in the GAC, all your EXEs will be able to find it.

    The DLL needs a Strong Name before it can be deployed to the GAC. Visual Studio can apply the Strong Name if you configure it from the project properties.

    Wednesday, August 21, 2019 3:37 PM
    Moderator
  • The DLL must be deployed to the same location as the programname.exe so that .NET can find the DLL when the program calls for it.
    Wednesday, August 21, 2019 3:38 PM