I have access to a repository on GitHub that hosts C source files. Other people using this repository check out the code and build via the command line with CMake, but I want to add the source files to a Visual Studio project and build/debug using the IDE and a plugin called VisualGDB.
I use VisualGDB to "import an existing CMake project" from this cloned repository: it creates me a VisualGDB project at the location I tell it to, and allows me to build and debug the code it is referencing. I now want to use the Git integration that is in Visual Studio so I can see pending changes to the source code etc within the IDE, and not need to go to TortoiseGit or the Git bash.
I have pushed my VisualGDB project to my GitHub, and - quite rightly so - when I do so it complains
"Your solution contains files outside the solution folder which will not be included. See the output window for details about which files must be manually added later."
The only changes Visual Studio detects are those made to the files that are part of the project (like the .sln and .vgdbcmake) - is there some way I can "tell" Visual Studio to look at the Git information in the source code repository that I have pulled so it also "detects" changes to my source code?
CodePudding user response:
I figured this out. If I create my VisualGDB project within the cloned directory, then Visual Studio can "see" the .git folder and it uses it.
It seems that Visual Studio will use any .git folder in the directories immediately above the project directory, but it won't look in any subfolders. So the problem in my case was that I had a directory structure like this:
C:\Code\Visual_GDB_Project
VisualGDBProject.vgdbcmake
C:\Code\Cloned Respository
.git
<many source files>
...where the vgdbcmake file references the source files in the cloned repository.
When I changed this to be
C:\Code\Cloned Respository
.git
<many source files>
Visual_GDB_Project
VisualGDBProject.vgdbcmake
Then Visual Studio correctly displays the Git information for the Cloned repository. I can also add many other projects to my solution, and Visual Studio correctly displays the Git information for all of them, provided I have set "Enable multi-repo support" in Tools->Options->Preview Features. Note that I am using Visual Studio 2022 Pro.