Configure VS Code to work with TFVC repository

For those who want to work with repositories I will show you today how to configure VS Code to work with TFVC repository.

Let’s start!

As a prerequisites you need to install following programs
Visual Studio Code
VS Code download
Visual Studio (needed to have tf.exe file)
Visual Studio download

After successfull installation, go to extensions tab in Visual Studio Code and install Powershell and Visual Studio Team Service extensions like on example below.

Go to File->Preferences->Settings

And adjust configuration as below. Ensure that Version is adjusted to your Visual Studio (Community, Enterprise, etc.). If you have Visual Studio in version older than 2017 tfvc.location parameter will be a little bit different.
“tfvc.location”: “C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Version\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\tf.exe”,
“tfvc.restrictWorkspace”: true

In Visual Studio go to Team->Manage Connections…

Select project to which you want to connect in VSTS and click on Connect

Confgiure workspace according to your needs and press Map & Get

Go to VSTS page and click on your profile and select Security

Click on Add, Type name of token, choose when it will expire and scope for token.
Click on Create Token

Once the token is created you should save it in some place, as it will not be accessible any longer.

Go to Visual Studio Code click on File->Open Folder.
Choose the folder which you configure in previous step.
Go to command pallete (Ctrl+Shift+P)

Type Team:Signin

Paste token created in VSTS to have access to repository.
Congratulations! Configure VS Code to work with TFVC repository is completed.
When you put some changes in your local repository Visual Studio Code will show which scripts are not synchronized with VSTS repository.

I hope it will be usefull for some of you 🙂
Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.