Consider this (simplified it a little bit). I have 2 solutions. Both contain a specific project (say in d:\somewhere\Solution1 and d:\somewhere\Solution2). These solution both use a shared C# project, stored in say d:\csharp\CSharpSolution). This same project is used in a few other solutions as well (like Add/existing project.
Now when I would select File/Add to Source Control in VS, I get the following message:
Source Control - Git The current solution has projects that are located outside the solution folder. These projects will not be source controlled in the Git repository. To add all the projects to a single Git repository please consolidate all projects under a single folder.
This sounds insane to me. It would mean that I would need to make local copies of the C# library in each solution using it! Suppose I have 6 of such solutions and I change the C# code in one of them, I have to manually make changes in the 5 other copies.
I would want to organize it such that I an edit code of that "external" project from any of the solutions and be able to commit changes. Probably this: create a new solution containing only this "external" project with a separate repository. But I am not sure if that allows me to commit changes from the other solutions when I edit something in that project from there.
Any recommendations how to solve this without moving the external project to the solution directory?
Dick
Hi @ic2
By the error message presented, you are using Git as VCS.
If so, you could use git subtree or git submodule on your project.
The idea would be create a repository with the content of d:\csharp\CSharpSolution (let's say you name it as "common")
And then add "common" as a subtree/submodule of the repositories of your other projects (Solution1 and Solution2). This way, when you checkout Solution1, it will checkout also "common" - the same for Solution2.
The major work would be to change all the "common" references on Solution*, pointing them to ..\common folder
This way. whenever a change is made on Solution1\common, Solution2\common might take advantage of that - and vice-versa, with no need of rework or not - depending on the subtree/submodule strategy that fits better on your project(s)
Since all the project files are inside the same folder, VS won't complain about the files outside solution folder.
Hope it helps...
Read more about these Git funcionalities:
Git Submodule: https://www.atlassian.com/blog/git/git-submodules-workflows-tips?_ga=2.17821691.35403978.1560963940-384519158.1521550161
Git Subtree: https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.