How to connect TFVC (version control) to Visual Studio Code? Interested in basic operations such as checkin, checkout, resolve.
问题:
回答1:
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.
回答2:
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.
回答3:
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.
https://github.com/Microsoft/vsts-vscode
https://blogs.msdn.microsoft.com/visualstudioalm/2017/04/12/official-release-of-tfvc-support-for-visual-studio-code/
回答4:
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.
回答5:
use for windows:
correct forward slashes:
"tfvc.location": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/tf.exe",
回答6:
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
回答7:
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
回答8:
Set this :
"tfvc.location": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\TF.EXE"