How to map existing folders (which are moved to new machine) with the TFS without need to download the entire data from TFS? - visual-studio-2010

Earlier I had mapped my local folders to the TFS. I had to change machine/computer for some reason. So I copied all the folders to the new machine.
Now when I try to map the TFS folders to the existing folders on the new machine, it always shows Not Downloaded under the Latest column of the Source Control Explorer (VS 2010). I can get the latest version but it's very time consuming.
Can someone suggest a way to establish relationship between existing folders and the TFS folders in lesser time?

What you need is to have a workspace in your new machine that only has the mappings of your folders in TFS. If you just map your folders in your workspace, when you do a get, only files in your folders are downloaded locally, not the entire version control tree in TFS. Since you can copy your folders from one machine to another, downloading them from the server again shouldn't take more time than that.
From Source Control Explorer, let say you use the default workspace:
If you have jus a few folders, right click at each one and choose "Map to Local Folder", then specify the local path.
Alternatively, you can map from the root folder (of your folders), then cloak the ones that you don't want to download. Open the drop-down list of workspaces and choose "Workspaces", then choose to edit your workspace, then you can add and cloak the mappings of your folders like this:

Related

Move TFS workspace to new machine

I got a new computer and I have to move my TFS workspace. I found confusing info online, is this the correct approach?
Add TF server in VS of new machine
Copy folders from old machine to new machine (I have some files with pending changes)
Update TF workspace in new machine using the command:
tf workspaces /updateComputerName:oldCompName /s:"serverURL"
In VS (new machine), map projects. Is this required?
If you copied the entire workspace folders, then the map projects is not required, otherwise you have to map the projects (manage the workspace and map to the copied folder).
For example, if the original workspace is mapped to D:\Ad-workspace\2017\SCRUM-TFVC, then you have to copy the folders to the same path in the new machine.
Actually, you don't need to copy the workspace, just create a shelveset for the pending changes in the old machine, then connect to TFS from the new machine and map to a new workspace, then find the shelvset and unshelve, all the pending changes will be back to your new workspace.
TFS workspaces are identified by the owner, the computer name and the workspace name. If your new computer has a new name, you need to update your existing TFS workspaces to reflect that change.
Your process is correctly and the last step is required. After establish the mapping, you may get a promote message:
Newly mapped items will not be download, until you execute a get...
You could perform a get. Then copy your back-up files/folders which copied from main branch to the new dev branch. Windows system will judge to replace files and add new files.(It may take some time) After this, TFS system will auto detect the changes in local and will list them as new pending changes.
Everything get back to the same as you work in old machine.

Deleted project folders/files remain in VSO/TFVC and the file system

I had a solution containing the following projects:
Web App 01
Server Control Foo
Server Control Bar
Each project has its own directory in the root of the solution directory, directly mirroring the structure of the solution.
I branched the solution, then combined items 2 & 3 into a new project within that solution, then deleted projects 2 & 3. I committed the changeset. The resulting structure in VS2015 solution explorer was this:
Web App 01
Server Control Library
I then merged the branch, and committed this also. Over time, branching and merging has got slower and slower. On inspecting the file structure of my hard drive, and Visual Studio Online, I see this folder structure:
Web App 01
Server Control Foo
Server Control Bar
Server Control Library
Despite Solution Explorer not listing the deleted projects, the folders and files from all my deleted projects remain. Despite their status, they are also being branched every time. Is this the correct behaviour, and is it safe to delete them? If so, should I delete using VSO, Windows, or VS2015?
I assume you are using TFVC (changeset, branched the solution).
First, delete the projects from solution (right click the project in VS > Remove) just remove the relationship between projects and solution, the projects’ files and folder are still existing in the hard drive. So you need to delete these files and folders from hard drive (file system).
Secondly, these files are still existing in the source control too, because they aren’t marked as deleted if you just remove projects from solution, so check in changes just affect the solution file, it won’t delete files from source control. So you need to delete them from source control and it’s safe.
Steps to delete files:
Go to Source Control Explorer in VS
Right click Folder or file > Delete
Check in changes
BTW, the files still can be restored if you don’t permanently destroy them. (Destroy command), more information, you can refer to this article: Delete or restore files and folders in Team Foundation Version Control (TFVC)

Unmap project without physical deletion in VS2013 + Visual Studio Team Services (was TFS Online)

I have Team project in TFS, and I map it to folder "Common projects" with many projects inside, by example
Common projects
prj1
prj2
..
prjn
TFS adds all of them and it slows my machine. I want to unmap most of them, but if I make "Remove mapping" for prj1, it also deletes its folder physically from my hard drive. Is there a way to map projects in mapped folder selectively, and leave other on harddrive? Or I need to create separate folder especially for synchronization with TFS..
upd.:
I update my post with answer as I understand from google that people searching the solution.
Step 1: File-> Source control-> Advanced-> Workspaces-> Remove, click "No" when popup dialog appears. But after this on next random "Get"(on other project in other folder) - files will be deleted from local, becouse TFS "remembers" associations even they are removed from Workspace. To prevent it - step 2:
p.s.: try it on Your own risk, make backups and tests.
You are looking for something called Cloaking. By using cloaking, you can map a root folder to a local workspace. As you've noticed, this implicitly downloads all the sub folders beneath the root folder.
When you now select a sub folder you don't want, you can select Cloak. This means that the sub folder (and anything beneath it) won't be downloaded to your pc.
The MSDN topic Optimize your workspace has the info you need. If you look at the example, you want to perform step 2 and 4.

TFS: Statuses for solution & projects invalid after moving folder

OK, so one or more of the references required that the solution be in C drive. I cut-pasted the solution from one folder in D drive to another in C, and bam, all TFS bindings went down the drain.
I've changed my workspace local folder to point to my new folder, so I'm not sure why TFS doesn't recognize it. OK, I admit I was working without TFS connection for a period of time, but now I would like to get some changes checked in. But when I go to File -> Source Control -> Advanced -> Change Source Control, it tells me that the Status for my .sln and .proj files are all Invalid.
I've tried unbinding and rebinding projects but this doesn't seem to work.
This is frustrating. Is there any other way than to delete and re-download the entire solution? Or is this a caveat of TFS, is there any file on my hard drive that defines my solution location? It's 10GB worth, I don't want to need to do this every time I move my solution, especially when I actually have all the files on my hard drive.
If I understand you right, you had your sources connected to TFS on your D: drive. For some strange reason you needed to move them to C: drive and you did this by using Windows Explorer (or any other not TFS related tool)? After that you changed your code and now want to check it in to TFS, but it denies it. Right?
The problem is that TFS didn't got any information about your moving and changes you made in the new location. This only works if you used "local workspace" setting when creating the workspace or if you changed your workspace to the new location and checked out the files there.
How I would "fix" this:
Copy/save your current code changes in a temp folder
Open VS/TeamExplorer and create/change your workspace to the location where you want your sources on C:
Do a "Get Latest Version" on your workspace, to download the sources from TFS and to update the workspace in TFS
Checkout all files in your workspace (checkout root folder with recursive option)
Copy your saved code from step 1 into your workspace
check in your changes (check in on root folder of workspace again with recursive option)
your sources are now linked to and stored in TFS
Under "Tools-> Options-> Source Control -> Environment -> Saving/Editing" set the value to check out automatically, so that VS will to the checkout for you automatically when changing a file in VS.

How can I force TFS to let me download a folder (other than methods listed)?

I have a seemingly common problem, but cannot find a common solution that will work for me. I recently had my computer re-imaged and am now in the process of redownloading a solution from TFS. One of the solution folders contains 2 folders that list "Not downloaded" in the "Latest" column of the Source Control Explorer. When trying to open the solution, I get the error "The project file could not be loaded. Could not find file x". I've tried the methods listed below, to no avail:
Get Specific Version, checking Overwrite options
Deleting, .suo file, restarting VS2010
tf get /force
Remove mapping, deleting local files, remapping entire TFS project to local folder
tfpt rollback /changeset where the last changeset for the .csproj listed a branch and a merge as pending changes by me
File -> Source Control -> Open from Source Control, Navigate to TFS project, try to open .csproj in undownloaded folder, receive error "The selected file cannot be opened. The project file has been moved, renamed or is not on your computer."
I may be missing other things I've tried, I'll be sure to update this list if I can think of anything.
Besides those listed above, is there any other way to get those 2 folders and their content from TFS?
Try browsing via visual studio command line to the directory and do a:
tf get . /force /recursive
This should forcibly recurse down from the current directory.
You have tried most of the things that I would suggest. A force-get-latest should work if it's a simple case of TFS being confused about what is on your pc.
Are the "folders" in tfs, or in your solution explorer? Folders in the solution explorer typically mirror the real disk structure, but it is possible to get files and folders in a different location in the SE than on disk. This coild mean that the files the solution explorer is referencing are not mapped into your tfs workspace.
I would check the workspace mapping is as simple as possible (no branches or extra unneeded folders etc), close the solution, force-get the latest version of the disk structure from the source control view, and then load the .csproj file in a text editor to check exactly what the project is referencing to be sure that all the files exist and are in sensible places on disk.
I found the problem. I recently added a certain domain group to the TFSProject/Readers TFS group, then explicitly denied access to all rights in those two folders. It seems that although I am in the Contributor TFS group, I'm also a "Reader", so I denied access to myself.

Resources