I’m looking for some advice on best practices for Visual Studio workflows.
I maintain several C# libraries which I use in various projects I develop. I also make them available publicly, as packages on NuGet and as source code on GitHub. Because I am often tinkering and tweaking my common libraries as I use them, I typically add the ones I need in a particular solution as external/existing projects. To keep things organized I add them to a solution folder I set up called “external”:
I can then use them in any other project within the solution by simply adding them as a project reference.
To ensure other developers will be able to build my projects from GitHub source code I also include references to their NuGet packages in the projects (i.e., I “double specify” the common libraries, once as a NuGet package and once as an “external” project). VS is smart enough to pick whichever version is more recent, so when I tweak something on my development machine the shared library gets rebuilt as part of the build process:
This works well…for me.
But because this all gets published to GitHub it complicates the life of anyone who clones one of my solutions and tries to build it. Since they haven’t duplicated the folder structure of my development machines those “external” projects are undefined and cause builds to fail.
It’s easy enough to simply delete those external projects and the external solution folder. The required libraries will still be incorporated because I include references to their NuGet packages in the projects that use them (note that this requires I update any tweaked common library NuGet packages before I publish the app or library which uses the tweaked library).
I can solve the “missing external projects” problem other developers encounter when cloning my GitHub source code by simply deleting the external references when I push a main/master update to GitHub (and ensure the shared NuGet packages are also updated). But that requires me to remember to do that as part of the publication process...and go through the hassle of re-creating the "external" projects the next time I need to tweak something in the solution.
I could also simply tell other developers, via the README, that they should delete those external project references and the external solution folder. But that seems kludgy.
I’m curious if there’s a better workflow which continues to allow me to tweak/evolve my shared libraries but doesn’t require either me or other developers to jump through hoops to get things to build.