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.