Microsoft has introduced Team Foundation Server Version control for Visual Studio Code. In this blogpost, let us look how to incorporate it into your environment.
TFS control is available as an extension, go to extensions in visual studio code or press Ctrl + Shift + X or use this link https://marketplace.visualstudio.com/items?itemName=ms-vsts.team
Before proceeding next step, make sure you have your Personal Access Token (PAT) with All Scopes available to securely access your TFS account. The latest version of the extension will prompt for your token and store it securely. In previous versions of the extension, you needed to create a token and store it in your Visual Studio Code settings. Please follow this link to get your Access token https://docs.microsoft.com/en-us/vsts/accounts/use-personal-access-tokens-to-authenticate
TFS support for Visual Studio Code relies on TF command line client. You can find the TF command line interface in the below locations,
Previous versions of VS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TF.exe
Latest versions of VS 2017: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe or
C:\Program Files (x86)\Microsoft visualstudio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe
Now let’s configure the TF command line location in Visual studio code settings like below,
To go to Visual Studio code settings, go to “File -> Preferences -> Settings” or press “Ctrl + , (comma)”
Now we are in last step to provide your TFS credentials, there will be an indicator in the status bar whose message will indicate that you need to sign in. The indicator will be like this:
Simply click on that indicator, If your repository is on Team Foundation Server 2015 Update 2 or later, you will be prompted to enter your username and password otherwise you will be prompted to enter your personal access token which we got in our second step. Once the credentials are verified it will be stored in your computer securely.
To go to TFS source control in your visual studio code, you can use the press Ctrl + Shift + G or click this icon in your left pane.
Let’s see how to use TFS commands in Visual studio code in out next blog (Part-2) And as always, feel free to reach me out if you have any questions. I would be glad to help.