I created a new web api project in visual studio 2022, just using the master branch created a repository in GIT and whenever I make changes to that project the VS detects where I can commit, but when I create a new project for example a Class Library it does not detect any change I make to it even a new class.
This is getting frustrating, created it three times in different directories.
Restarting device and VS did not help.
Folder Structure:
F:\MyProject\MyProject\git
F:\MyProject\MyProject\MyProject.sln
F:\MyProject\MyProject.ClassLibrary
>Solution :
Folder Structure:
F:\MyProject\MyProject\git
F:\MyProject\MyProject\MyProject.sln
F:\MyProject\MyProject.ClassLibrary
That’s the problem. The Git repository is more of a file system concern than a Visual Studio Solution concern. If the new project is outside of that folder structure then Git doesn’t see it, for the same reason it doesn’t see the rest of your hard drive.
Initialize the Git repository in the root of everything you want it to track, not just in one project folder. (Or, conversely, add new files under the folder where Git was initialized, rather than outside of it.)