Visual Studio defaults to Git Source Control on opening TFS Solution

Martin Janik 0 Reputation points
2024-04-03T08:10:38.9933333+00:00

I have multiple solutions stored both in TFS and Git. When I launch the VS as an Administrator, "Start Window" is shown. Then, I select a TFS solution. The VS opens, loads all projects under the TFS solution and when loaded, it automatically starts unloading all projects and loads Git solution. After this, I have to open "Start Window" from VS and select the TFS project again. After VS unloads the Git solution and loads TFS solution everything works just fine.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,415 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Anna Xiu-MSFT 30,821 Reputation points Microsoft Vendor
    2024-04-04T03:56:53.6666667+00:00

    Hi @Martin Janik, 

    Welcome to Microsoft Q&A! 

    Which version of Visual Studio are you using? 

    Please ensure you are connected to TFS in VS.

    Then, open the VS and go to Tools > Option > Source Control > Plug-in Selection > Current source control plug-in: Visual Studio Team Foundation Server.

    User's image

    Besides, please check if there is a .git folder in the source directory. If it exists (it may be hidden), please backup and delete it. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

     

    0 comments No comments

  2. David W 0 Reputation points
    2024-10-24T11:57:15.3466667+00:00

    I encountered precisely this issue: Starting Visual Studio 2022, opening a TFS controlled project, only to have VS launch it within GIT. I searched multiple forums and found multiple instances and variations on this issue, all of which were never resolved or closed. Here is what we finally found:

    The GIT provider is installed by default and also establishes a default repository, often at something like c:\users\username\source\ or c:\users\username\source\repos. Be absolutely certain you do NOT map any server TFS project folders to a location in the same folder. Instead, map them to an entirely separate directory, eg c:\TFSProjects

    The apparent behavior of GIT, even if no provider is selected (Tools->Options->Source Control->Plug-In->None), is to assume any solution or project file opened within the designated GIT repository will be treated as being under GIT control, even if it contains an explicit TFS enlistment. This will also be true even if there is no hidden ".git" folder.

    We came close to overcoming this when we set VS 2022 Source Control Plug-in to none, opened the solution, but the bindings were inexplicably invalid. We attempted to rebind the solution and projects, but received an "Unspecified Error." When we tried to reload the project, VS returned to its prior behavior of invoking GIT despite no such enlistment.

    When we remapped the TFS folder within the Source Control Explorer to a location entirely outside the GIT repository, this behavior was eliminated, and TFS-controlled projects opened under TFS control, as expected, and with no further issue.

    I researched several posts with variations of this problem on various forums, Stack Overflow, MS Dev community, but never saw any solutions or responses beyond "closed, not a bug, can't reproduce, not important, suggest an improvement," and while I can't promise it will resolve every instance of this issue, it is my hope someone sees this and finds it beneficial for their circumstance.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.