3

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.

4
  • Do any files show up as adds in the Git Changes page in Team Explorer? Commented May 15, 2018 at 15:38
  • You shouldn't need to do anything special in Visual Studio. Just add the files to your Git repo. Commented May 15, 2018 at 16:47
  • 1
    Suggest you add a related Visual Studio screen shot, which could make your question more clearly. Commented May 16, 2018 at 10:03
  • @ChadB B No the files don't show up in the changes view in TFS. @ DanielMann Tried that, the project isn'[t then associated with the solution and when I try add it after cloning the repo again I get the same issue. Commented May 17, 2018 at 9:45

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

0

Found a friendly video on YouTube that's easy to understand: How To Add An Existing Project To Your GitHub Repo With Visual Studio

I think the steps are:

  1. Create a new project on your git server like GitHub or git on tfs etc..

  2. Clone the new project to your local desktop in a folder somehow.

  3. Copy all the files from your existing project making sure there is no .git in root to your new folder that you cloned which should have a .git in the root. If you don't see it its probably because the files are hidden and if you want to verify that it existing you'll have to go into file explorer and check the show hidden files option to checked.

  4. Commit the changes locally

  5. Push the changes to the origin or to the remote server... Origin is just a fancy name or qualifier for your git server that you are subscribed to like GitHub, TFS git, or your own personal git server where you set that up yourself. Just remember the client app like TortoiseGit or GitSVN is not a git server … its just your local git app for storing branches locally before you also use to push to the remote server and for pulling the latest changes from a particular branch name or revision via a guid.

  6. Git is not really something you can just get after the first use. You'll only get it after you use git like 100 times.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.