Reputation: 3163
I have a Visual Studio Community Edition 2019 solution with only one project. Whenever I add a source code file to the project, I don't see any changes to git's working tree and therefore it's not added to version control. That causes 2 problems:
Searching my git repository for the new file, it only shows up in .vs/<solution_name>/v16/.suo and the .vs directory is in .gitignore. From what I've read at Should I add the Visual Studio .suo and .user files to source control? , this .suo file contains machine-specific configuration and should be ignored by version control, but it seems it also contains the project tree? I see several *.cs files in the .csproj file, but for some reason the files I add to the project tree via the VS UI are not to this file. Am I doing this wrong?
Upvotes: 0
Views: 162
Reputation: 3163
I saved the project and the .csproj is updated with the new source code file. I got spoiled with web applications that auto-save.
Also, you must close the solution and open it again whenever you change git branches so that Visual Studio realizes that the .csproj file has been updated.
Upvotes: 1
Reputation: 1
When i added/changed exsiting files in the VS solution, the project file (xxx.vcxproj
) changed.
An example of added line in this project file can be found in the git diff
as
<ClInclude Include=/path/to/added/files />
So I would suggest to double check the .gitignore
file and whether your project vcxproj
is tracked.
Upvotes: 0
Reputation: 5403
This sounds like you have an overly aggressive .gitignore file in all honesty. I'm not sure what you mean by the 'project tree' being in the .suo, I don't think that's correct, the project file (.csproj) defines which files are included in a project. If you can run git add .
from a command prompt under the project directory and you still don't see any local changed files, I'd point to the .gitignore as being the problem.
Upvotes: 0