24
votes

When I started working on a project I downloaded IPAddress\CompanyName\ProductName\DevBranch in TFS, mapping it to C:\DevBranch. But now I want to map the root folder to a local path, so I've mapped IPAddress\CompanyName to C:\CompanyName. However, IPAddress\CompanyName\ProductName\DevBranch is still mapped to C:\DevBranch and not C:\CompanyName\ProductName\DevBranch.

How do I change the mapping of this local path? I want to have it automatically move all the files from the old local folder to the new local folder.

Everything I've looked up keeps talking about editing workspaces, and only seems to apply to changing the root folder. When I go to edit my workspace, the only local mapping that shows up is C:\CompanyName. There's nothing that allows me to change mappings on a subfolder-by-subfolder basis.

EDIT: I've now tried editing the workspace by adding a new working folder, setting the source control folder to IPAddress\CompanyName\ProductName\DevBranch and the local folder to C:\DevBranch, then changing the local folder to C:\CompanyName\ProductName\DevBranch, and it still didn't work. Source Control explorer is still showing C:\DevBranch as the local folder. Please help. I don't know what to do.

EDIT: I was able to right-click IPAddress\CompanyName in Source Control Explorer and click Advanced > Remove Mapping. However, no such option existed when I right-clicked IPAddress\CompanyName\ProductName\DevBranch. It's like some kind of zombie mapping. I can't change it, I can't remove it, and Source Control Explorer keeps showing it without acknowledging the mapping exists in most cases.

5
Are you sure you're looking at the correct workspace?Daniel Mann
There's just one. However, there was a duplicate MyWorkspace_1 that I removed because it didn't have any folders in it. Could that have represented the DevBranch subfolder? If so, how come the subfolder still points to a different location after I removed its workspace?Kyle Delaney
Which version of VS do you use? I tested with VS 2015 and 2017 everything works correctly. Just try to clean the caches for your VS client, also try to restart the VS, then try it again.Andy Li-MSFT
I'm using 2017. Cleaning the caches sounds like a great idea. How do I do that? Is the mapping information stored locally or on the server?Kyle Delaney
I've created a followup question here: stackoverflow.com/questions/46550033/…Kyle Delaney

5 Answers

30
votes

If you want to change the local path for the working directory of the Team Foundation Server (TFS), you need to go to File -> Source Control -> Workspaces (File -> Source Control -> Advanced -> Workspaces for VS2017), then select your workspace (it should match your computer name) and click Edit.

In the next dialog change the mapping for the root TFS node to the new location on your hard drive. You need to perform a "Get" on the whole TFS tree to update project associations.

16
votes

There is the issue in Source Control explorer, there is a feedback: Manage Workspace Issues - Changing the Local Path of a Project.

You can get the latest version by clicking Get Latest Version (your screenshot), then the files will be in the correct folder and the cache will be updated, then you will find the path is changed in Source Control explorer.

6
votes

For VS2017 you can change local path from File -> Source Control -> Advanced -> Workspaces... In the manage workspace dialogue box, you need a select row of which contains your computer name, then edit it and change the local path.

3
votes

about "You need to perform a "Get" on the whole TFS tree to update project associations", it also works if you make "Get" at the branch root level (whole TFS tree could be too much )

0
votes

I followed this steps on vs 2019

1- Open Source Control Explorer

2- Select your Directory that you want change local path.

3- Right click on you selected directory and from "Advanced" menu select "Remove Mapping"

4- You can see your current local path on local folder text box or you can change it, then press "Remove Mapping" button.

5- After Map Removed, from "Advanced" menu select "Map to Local Folder".

6-Select Local folder

7-Click Map button