20

How to connect Visual Studio Code on mac with Team Foundation Server(TFS).

Or any other way to connect with tfs?

Pritish
  • 2,194
  • 2
  • 21
  • 44

4 Answers4

20

This are the steps to effectively connect a TFS (TFVC) Repository to your VS Code on Mac:

INSTALL THE SOFTWARE

  1. Install Visual Studio Code for Mac (currently here: https://code.visualstudio.com/download).
  2. Install the TFS extension for VS Code: Go to the Extensions tab in VS Code, Search for TFS and install.
  3. Install TEE-CLC. Follow this guide: https://www.youtube.com/watch?v=VPNaEIVZfr0&feature=youtu.be.

CREATE A LOCAL TFVC WORKSPACE IN YOUR MAC

Now you need to have a local TFVC Workspace on your machine. If you don't have one (as it was my case), you need to create it. The following steps are partially extracted from https://stackoverflow.com/a/21785438/2816119.

  1. Create a local folder where you are going to download and locally store the source code.
  2. Open a Terminal window.

  3. Create a local workspace from your terminal window with the following command:

    tf workspace -new MyWorkspace -collection:<<<http://full.URL.of/your/repository>>>
    
  4. Map your repository folder to your local folder with the following command:

    tf workfold -map '$/your/repository/folder/path' /your/local/folder/path -collection:<<<http://full.URL.of/your/repository>>> -workspace:MyWorkspace
    
  5. If everything went well, you'll see a new sub-folder ".tf" in your local folder.

  6. Open your local folder with VS Code. If everything went well you'll se after a few seconds the TFVC icons in the bottom bar: enter image description here

GET THE SOURCE CODE

To get the source code you'll need to go to the Source Control Tab -> Ellipsis (...) button -> Sync.

enter image description here

Once you press it you'll see a progress bar moving in the Source Control Tab and you'll see how the source code is downloaded to your local folder.

ENJOY

Now you can use your TFVC repository as described in their guides. If something is not clear or you have questions please let me know. I'll try to help you :-)

vbhakta
  • 107
  • 1
  • 6
juangalf
  • 832
  • 1
  • 10
  • 17
  • 2
    TEE-CLC can be downloaded from here: https://github.com/Microsoft/team-explorer-everywhere/releases – Jason Nov 07 '17 at 23:13
  • 2
    I finally got it to work but I still don't have a ".tf" folder. The VSCode extension finds what it needs by running `tf workfold /your/local/folder/path` – Patrick McElhaney Feb 28 '18 at 14:03
  • 1
    @PatrickMcElhaney please note the .tf folder is hidden by default. Press "CMD + SHIFT + ." on Finder to reveal hidden folders. Please let me know if that was the case. – juangalf Mar 02 '18 at 16:09
  • 1
    @juangalf It's really not there. Did not show in in Bash with `ls -a`. I've since found that it works even if I create the mapping before creating the folder. – Patrick McElhaney Mar 02 '18 at 20:56
  • 1
    Can we send/Receive & perform Code reviews/request from here? – GreenROBO Aug 17 '18 at 11:44
  • @GreenRobo I'm not sure as I've never used that functionality. Maybe it's available using a command for the Team Services extension? Maybe this resources can help you: https://www.youtube.com/watch?v=sk6LrzQX4P8&feature=youtu.be or https://github.com/Microsoft/vsts-vscode . Please let us know what you find. Thank you. – juangalf Aug 19 '18 at 17:14
  • 1
    @juangalf Thank you for your reply. I tried given github url but no luck. you can find same information mentioned here. https://github.com/Microsoft/vsts-vscode/issues/292 – GreenROBO Aug 20 '18 at 04:58
  • 2
    I also was not able to get a `.tf` folder, despite everything suceeding. Any help is appreciated. – mcsilvio Dec 26 '18 at 10:53
  • @mcsilvio Please make sure you are able to view invisible files in your system. One quick way to do this is to create the .tf folder manually and check if you can view the folder with a new Finder window. – juangalf Jan 02 '19 at 22:39
  • 1
    `ls -la` is what I used. – mcsilvio Jan 03 '19 at 13:36
  • 1
    A vital detail, the extension seems to be only available for version 2017 of Visual Studio release 7.5 or later. I ended up manually downloading version 7.8.4.1 of Visual Studio Professional for Mac OSX and was then finally able to see and install the TFS extension. – JulianHarty Feb 19 '20 at 16:04
6

Get the software

Create a workspace using tee-clc ("tf")

Tell tee-clc to remember your credentials (in OSX's Keychain) by adding this line to your .bash_profile. Then close and reopen your terminal or just paste the same command.

export TF_AUTO_SAVE_CREDENTIALS=0

Accept the EULA.

tf eula

Create a workspace.

tf workspace -new MyCoolWorkspace -collection:https://my-server.example.com/tfs/DefaultCollection 

Map a path on the server to a local folder.

tf workfold -map '$/Path/To/Folder' /path/to/your/local/folder -collection:https://your-server.example.com/tfs/DefaultCollection  -workspace:MyCoolWorkspace

Get the code and store your password. Make sure you type your actual username; if you enter your_username here it may get stored in the OSX Keychain and tee-clc is really dumb about replacing it later.

cd /path/to/your/local/folder
tf get -login:your_username

If it works, it will download your code to that folder. You can also use the other commands.

Use the Azure Repos Extension on VS Code

Get the Azure Repos extension.

Add the following settings (CMD+,):

{
    "tfvc.location": "/usr/local/bin/tf",
    "tfvc.restrictWorkspace": true
}

Type which tf in Terminal to find out what the value for location should be. I'm not sure if "restrictWorkspace" is necessary. I got it from a comment on Github while I was troubleshooting.

Finally, open the folder containing your code. From the command palette (⌘+⇧+P) type Team: Signin. If that works, you can start using the other features in the plugin.

Patrick McElhaney
  • 57,901
  • 40
  • 134
  • 167
  • I can get right up to the last step..but no luck. TEE-CLC is working and "tf workfold" from a VSCode 1.19 Terminal produces the expected workspace. But though many "Team:" commands are listed on the command palette, running any of them such as "Team: Signin" produces "command 'team.Signin' not found". Any ideas? – Ralph Hinkley Mar 14 '18 at 20:12
  • 1
    Check and make sure your password is stored correctly in the Keychain. Also look for clues in team-extension.log which should be created in your local folder. – Patrick McElhaney Mar 15 '18 at 21:07
  • 1
    I confirmed the keychain which had my "[user].visualstudio.com" name, Kind=Internet Password, and date-stamped properly. I also confirmed the .bash_profile edits. Once confirming both....it just started working... Thanks for the help and prompt reply. – Ralph Hinkley Mar 23 '18 at 15:25
  • This worked for me as far as getting `tf` installed and the codebase downloaded. In my case including the `/DefaultCollection` at the end seemed to cause errors and I had to remove it. – Meekohi May 23 '18 at 14:28
  • 1
    I have the next error: **No Azure DevOps Services or Team Foundation Server repository configuration was found. Ensure you've opened a folder that contains a repository**. I am tired nothings work. – Brayan Loayza Oct 18 '18 at 18:54
2

GIT

VS Code ships with a Git source control manager (SCM) extension. Most of the source control UI and work flows are common across SCM extensions.

More details please refer this tutorial:Using Version Control in VS Code

Note: VS Code will leverage your machine's Git installation, so you need to install Git first before you get these features. Make sure you install at least version 2.0.0.


TFVC

You can connect to TFVC using the Visual Studio Team Services extension since version 1.116.0 (2017/04/12).

Note: You need Team Foundation Server 2015 Update 2 or later.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 1
    I have tried with this, but its connecting to the vusualstudio.com server, I need to connect my local TFS server – Ganesh Jul 10 '17 at 08:07
  • Hi @Ganesh This could also connect to local TFS , which version control are you using tfvc or Git ,besides which version of TFS are you working on? – PatrickLu-MSFT Jul 10 '17 at 08:30
  • Thank you, Currently No version control, I have a Tfs account and just downloaded the Visual studio code and installed the team services extension Now I have a project folder with created in Visual studio 2017, need to manage with my Tfs account in server. So can you please let me know how to do this process. Thank you, – Ganesh Jul 10 '17 at 09:12
  • 1
    Do you know How to get the TFVC path location in Mac? – Ganesh Jul 10 '17 at 11:14
  • @Ganesh sorry for the later reply, you just need to have a local TFVC workspace available. As a new user, you can find that information (**including demo videos**) in our [TFVC documentation](https://github.com/Microsoft/vsts-vscode/blob/master/TFVC_README.md)--**Getting Started Videos**. – PatrickLu-MSFT Jul 10 '17 at 11:53
  • 4
    @Patrick-MSFT you can't do that. In the documentation and in the video I see: "Open a folder containing a Local TFVC Workspace and sign in when prompted". As a new user, you don't have a local TFVC workspace. How can someone check this out? All the docs are very unclear. I did this myself by using Visual Studio 2017 on Windows, where you can install Visual Studio Enterprise. On Mac, all the installation files points to the same Visual Studio Community version which _cannot_ connect to TFVC. So, it's impossible for a Mac user to get the first checkout of a TFVC repo. What now? – Richh94 Jul 25 '17 at 11:29
  • 1
    @Richh94 you're right, the documentation is very unclear, but I finally managed to create a brand new TFVC repository in Mac using only TEE-CLC. You can check my answer below: https://stackoverflow.com/a/47006473/2816119. – juangalf Oct 30 '17 at 12:19
-1

Check the below link. It is working fine for me

How to use TFS on a Mac

Steps to be followed:

Step 1: Install Eclipse

Step 2: Download and install the TFS everywhere plugin

Step 3: Checkout your solution using the eclipse to a local folder

Step 4: Open the solution in Visual studio and make the code changes

Step 5: Open eclipse and commit your changes.

Shyju M
  • 9,387
  • 4
  • 43
  • 48
  • 4
    That seems like the worst solution. Using Eclipse IDE to do checkin/out, and using VSCode IDE to do edits. – Whitecat Oct 11 '17 at 14:41
  • 1
    Visual studio for MAC IDE doesn't have TFS integration yet from Microsoft. That's why I am suggesting an alternate way. check the link https://developercommunity.visualstudio.com/content/problem/56252/why-not-include-tfs-in-vs-for-mac.html – Shyju M Oct 11 '17 at 16:47
  • 1
    I am not saying your answer is wrong. I am just saying that @Patrick-MSFT, and MS should come up with a better solution. – Whitecat Oct 11 '17 at 20:13
  • After spending hours on this. This appears to be the only solution that works today. It must be an older version of Eclipse too. I used Neon. – Bwizard Jul 12 '20 at 13:57