Search code examples
c#visual-studiopowershelldllbuild

I have a C# dll that I am using in several C# projects. If I update the dll I have to rebuild all the projects manualy. How can I automate this?


I have a C# dll (VS 2022) that I am using in several C# projects (VS 2022). If I update the dll I have to rebuild all the related projects manually.

  1. Is it possible to program something in the dll that when I build it, all the related projects are built automatically

  2. If 1) is not possible, can I make this automation with a separate C# project or powershell script?


Solution

  • With Visual Studio and assuming all the source code for the DLL and the consumers of the DLL is in the same source control repo:

    • Create a solution (.sln)
    • Add all the projects to the solution, including the DLL project and the projects that depend on the DLL
    • In the projects that depend on the DLL, add a project reference to the DLL project

    Building the solution or building a specific project within the solution will check dependencies.