How to connect TFVC (version control) to Visual Studio Code? Interested in basic operations such as checkin, checkout, resolve.
-
This is not a code related question. Should get moved to Super User. – Florian Leitgeb Aug 09 '17 at 12:45
8 Answers
Microsoft recently released Visual Studio Team Services Extension for Visual Studio Code.
The process of installing is pretty straight forward:
- Search for Visual Studio Team Services in VS Code and select to install the one by Microsoft
- Open File -> Preferences -> Settings
- Add the following lines to your user settings
If you have VS 2015 installed on your machine, your path to Team Foundation tool (tf.exe) may look like this:
{
"tfvc.location": "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\tf.exe",
"tfvc.restrictWorkspace": true
}
Or for VS 2017:
{
"tfvc.location": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\tf.exe",
"tfvc.restrictWorkspace": true
}
From View -> Command Pallette ..., type team signin
In this step, you need to provide a personal access token.
If you already have VSTS account, go to VSTS online website. Under your name (top right corner of the screen), click Security, then click Add and then Create Token Copy and paste the generated token to VS Code
Hope it helps.

- 1,274
- 15
- 18
-
-
i haven't personally tried it on a mac, but I guess as you know the path to tf.exe you should be able to use the same settings. – Babak Jan 14 '18 at 04:57
-
1Just thought I'd mention that Enterprise for VS 2017 only works if you've got Visual Studio 2017 Enterprise Edition. I've got Community edition, so I have to use Community instead. – Rod Jan 28 '18 at 02:04
-
-
Have you tried C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\tf.exe? or C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\TF.exe? – Babak May 18 '18 at 12:27
-
@Babak The century old question, how do we set up VSCode to use TFVC behind a corporate proxy? The answer is quite complex actually. In my case, my username has a space, and I usually follow this pattern `http://user name:password@proxy:port`. This works for my `.gitconfig`, `.npmrc`, etc...; however, I had to encode the space with `%20` on vscode(`http://user%20name:password@proxy:port`). Go figure. – Aaron C Dec 30 '19 at 16:52
Visual Studio Code supports Git, not TFS. If you have a TFS-hosted Git repo, you can connect to it the same way you'd connect to any Git repository. If you're using TFVC for source control instead of Git, you won't have integrated source control. You can still use the Team Explorer Everywhere cross-platform CLI to perform source control operations against TFS, but you won't have an integrated experience.

- 57,011
- 13
- 100
- 120
Microsoft released a new version of a plugin called Visual Studio Team Services (vsts-vscode) that has TFVC version control support. It is supposed to work with Team Foundation Services as well as on-premise TFS.

- 1,400
- 11
- 14
https://github.com/ivangabriele/vscode-tfs
It works pretty well, but it is built on the tfs for nodejs library (https://github.com/ivangabriele/tfs) which assumes you are on vs2015.
If you are on 2013 or earlier you need to navigate to: c:\users\.vscode\extensions\ivangabriele.vscode-tfs-0.3.5\node_modules\tfs\config\ and update the settings.json so that the tfPath and vsVersion are correct.

- 51
- 1
- 3
-
Does it mean that I have to install Visual Studio 2015 and nodejs library in order to use VSCODE with TFS? – Gleb Svechnikov Mar 14 '16 at 12:18
-
No, like I said, if you are on 2013 or earlier then you just update the tfPath to point to the correct location and set the vsVersion. The path I specified is just to the dependencies of the extension after you have installed it.You install the extension by using the command palette (ctrl+p) and typing ext install tfs. – Matthew Ferguson Apr 02 '16 at 01:59
-
1I think he meant that its useless from cross OS point of view if you have a dependency on ANY version of Visual Studio, and generaly on .NET Framework. – Cristian E. Sep 06 '16 at 13:41
-
This post was incredibly helpful for me - the plugin had **assumed** the incorrect version of Visual Studio for me (2012 instead of the 2017 that I was on), and therefore was not working. Changing the settings.json file to point to the relevant location and version have resolved the issue. (location for 2017 is: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe) – CDK Apr 10 '18 at 13:12
Adding an answer because it solved my problem. I got the following error:
"No team project found for this repository"
Note: I had to previously ensure I had a Local TFS workspace set up (See GitHub link below).
In order to get VS Code working properly with TFS, I had to modify my workspace so that it was at the same level as a Team Project (on the server).
Also, I don't know if this was necessary, but I set the following configuration:
"tfvc.restrictWorkspace": true,
in my VS Code User Settings. I hovered over it to learn I had to set up a VS Code workspace, and did that, targeting the same directory as earlier.
I found this configuration, and other helpful information at the following Microsoft documentation (shows up when Code prompts you after you install the extension): https://github.com/Microsoft/vsts-vscode

- 1,017
- 6
- 22
- 36
use for windows:
correct forward slashes:
"tfvc.location": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/tf.exe",

- 173
- 1
- 8
In the 1.116.0 release of the Visual Studio Team Services extension for Visual Studio Code,support for Team Foundation Version Control (TFVC) has been added. Here is the link: https://github.com/ivangabriele/vscode-tfs

- 63
- 7
Set this :
"tfvc.location": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\TF.EXE"

- 11
- 4