11

I have always been able to create a project/solution and add it to source control and it will get added to TFS. In the last couple of months something has changed and when I create a new project/solution in Visual Studio 2015 Enterprise, it automatically uses git, even though the source control plugin is set to TFS. I have tried Tool>Options>Source Control and set the plugin back to TFS(VS resets this to git), closed Visual Studio, reopened and the plugin is still set to TFS until I add a project/solution to source control.

If I create a new project and add it to source control, I get no prompts, it immediately uses git(even though set to TFS). When I go back and look at the Source Control plugin it has been set to git by vs.

We don't use git, source control is TFS2010. Is there anyway of making VS it give me a choice of source control, or just assign it to only use TFS?

7
  • TFS is server-based, just like SVN. You can't create a TFS repository from the client's side. You can only create a new repository from the server, ie create a new Team Project Jun 1, 2016 at 14:04
  • BTW you should probably note that TFS itself supports git for version control and that is the preferred method nowadays Jun 1, 2016 at 14:04
  • I can usually add my project/solution to TFS from visual studio, I just need the ability to do this returned. Unfortunately I don't have the choice over whether I use git or not, the people I'm working for use TFS 2010 only so I don't have much choice in the matter.
    – Damian70
    Jun 1, 2016 at 14:08
  • What do you mean "do this returned"? The only valid question would be "How can I add the new project to an existing Team Project?". That's not how TFS (or SVN) works. You have to clone the Team Project locally, then add any new projects to it Jun 1, 2016 at 14:18
  • 3
    @PanagiotisKanavos Who said that Git is the preferred method for source control? Each organization and/or team has different requirements for version control. There are upsides and downsides to Git, just as there are upsides and downsides to TFVC. Saying that Git is "preferred" is inaccurate and misleading. Jun 1, 2016 at 14:46

5 Answers 5

14

A colleague of mine faced the same issue. He didn't check the "Add to Source Control" box when he initially create the project. Choosing "Add solution to source control" from the right click context menu in solution explorer adds the project to the local git repository. The solution was

  1. Tools -> Options -> Source Control tab -> Choose None in the plugin selection. (It may close the solution).
  2. Again Tools -> Options -> Source Control tab -> Choose VS TFS in plugin selection.
  3. Go to the root folder of your project and Delete the Git folder (It may be hidden - may need to show it first).
  4. In Visual Studio connect to a TFS team project.
  5. Try adding the solution to source control -> this should display the TFS dialogue.
1
  • 2
    Doesn't work. Every time I mark Add solution to source control VS 2017 reverts the plugin back to Git.
    – live-love
    Jun 14, 2019 at 21:41
6

Assuming you select Add to Source Control when you create projects. Try to connect to a TFS team project in Team Explorer before creating new projects.

enter image description here

1
  • 3
    Connecting to a TFS team project first solved the issue for me. Silly that Visual Studio doesn't warn you about this. If you don't connect to a TFS team project first, it simply creates a Git repository with no other notification. Sep 6, 2016 at 16:39
1

I recently had this exact issue and it was to do with my connections. From within the Team Explorer tab, click on the green plug to go to connections. Click on the blue 'Manage Connections' link and choose 'Connect to Team Project'. Choose your TFS server if necessary, ensure that your new project is selected in the right hand pane, then click 'Connect'.

Make sure that the steps others have highlighted above are done (.git files and folders deleted and Source Control Plugin set to TFS) and you should then be able to just right click on the solution and choose 'Add Solution to Source Control' and you should then be able to bind to TFS.

1
  • It's helpful to learn that you can just delete the .git folder from the Source directory and Visual Studio will 'forget' that it has been added to source control before. That allowed me to connect to TFS and then re-click 'add to source control' and select a TFS folder rather than automatically creating a GIT local source control entry.
    – TylerH
    Mar 6, 2020 at 22:38
1

I had this same issue after an update. I have to change the "plug in selection" to TFS, and then re connect to my TFS instance, for it to stop changing the default to GIT.

1
  • One extra step to try is, before trying to Add solution to source control from the right-click menu on the solution, go to Team Explorer and delete the local Git repo that was automatically created.
    – Chad
    Apr 21, 2017 at 20:54
0

I fixed this issue by deleting the system protected folder named like .git where the project is mapped on local drive. If you cant see the folder on the mapped location go to view -> options -> change folder and search options -> view , and then check 'show Hidden files and folders. Now restart the VSenter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.