Add existing project to source control in Visual Studio 2017 solution using Git repo in Team Explorer

10,413

Solution 1

So after trying everything I went back to the old VS hack of adding the project to the solution folder locally then showing all files in VS, then that allowed me to add it to the repository. Very counter intuitive, can't believe I had to resort to a hack.

Solution 2

You just need to make sure the existing project and the solution in source control you want to add, they are in the same local git repo.

Then do the git push from command line, or push/sync command in VS. The changes in local git repo will also sync with your remote git remote in TFS/VSTS source control.

Usually the "Add to source control" command will appear in the right bottom of Visual Studio. You could select the corresponding git repo.

enter image description here

Share:
10,413
Kevin T
Author by

Kevin T

Updated on June 26, 2022

Comments

  • Kevin T
    Kevin T almost 2 years

    I'm struggling to add an existing DB model project to an application solution in Visual Studio 2017.

    I'm using Git instead of TFVC for the repo and source control.

    When I add the existing project, everything builds fine at the solution level, but when I go to add the project to the solution in source control I don't see any changes, I've gone through dozens of MS Docs and forum posts around it but can't find a solution to this particular problem.

    Anyone else experience this and know a workaround? I can only find docs surrounding TFVC which is useless to me as we moved across from TFVC to Git a year ago.

    Apparently the VS Dev team are aware of this but haven't done anything about it, too concerned with new frameworks to worry about their platform actually working with all the plug-ins they officially support :(

    VS doesn't give me any options to "Add to source control" when I select the newly added project.