Visual Studio Source Control Explorer Duplicate TFS Project Folders - visual-studio-2013

Thought I saw this question answered somewhere on SO but I can't find it. My solution is properly displayed with its projects in Source Control Explorer, check ins are properly logged and the solution is mapped to my local workspace. (GREEN box)
However below the solution folder all the project folders are displayed again.The local path is not mapped and no check ins are being displayed. This is merely annoying to me but might seriously confuse my team. An hour of searching has turned up no solutions for getting rid of these ghost folders. (RED box)

No local path mapped to these folders indicates that these folders are no longer exist on the machine.
You can correct it via going to Source Control Explorer -> select these missing files -> Undo Pending Changes.

Related

Visual Studio 2017 - moved local TFS workspace folders - best/correct process to re-connect?

Had to move my directories for the local workspaces for Visual Studio. I updated the directory locations in VS, but it acted as if they were completely out of sync, and asked to get latest.
I let it do so for one project - it (re)downloaded everything, came up with a list of files to which I had local changes, listing them as conflicts. I kept the local version of all the files, so no work was lost. But when I opened the project, those files came up as not being in source control, and it offered to let me add them. So again, I have all my work, but that's a tedious process to re-connect everything. Not to mention that I'm not sure I caught ALL the files that needed re-adding.
I've also considered copying everything to other directories, download a clean copy of the project(s), doing a compare and folding in my changes. Still messy, but possibly safer.
Is there a far better way to do this practice that I've missed? Perhaps as a side question, is there an easy way to list all the files in a project not in source control?
Guess you moved/changed local TFS workspace folders in file system directly. This caused some folders/sub-folders/files lost mapping.
In other words, all of these folders already out of source control. That's why you need to re-add or re-connect them to TFS source control.
A right way please refer how to move an item in TFVC:
You can use Source Control Explorer to move one file or folder at a
time. You should not use Source Control Explorer to move folders or
files that are referenced by a Visual Studio project or solution. Move
these files with Solution Explorer instead and check in the move in a
new changeset.
In Source Control Explorer, select the item that you want to move,
open its shortcut menu, and choose Move.
In the Move dialog box, either manually type the destination for the
item in the To box, or choose Browse to use the Browse for Folder
dialog box.
Choose OK.
Move is actually a delete and re-add process. You could also take a look at this similar question here: Moving project (under source control) to different folder
In your situation, a quick way to solve the conflicts should be: First back up your local files, delete your old workspace, create a totally new workspace. Get latest version from sever side to your new workspace.
Then copy your back-up files/folders which copied from old workspace folder to the new one. 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. Some new add files maybe stay in the Excluded list, manually promote them in Included list.
Finally check in all your pending changes, everything should get back on track.

Visual Studio Team Services "stuck" in project

I have set up a number of projects on Git VSTS, and all was fine.
I then tried to add another solution to source control today, but the status bar along the bottom said it was already under one of the previous source control projects I set up - which is in a sibling folder.
The File->Source Control menu item was missing so I couldn't look at bindings or anything.
In the end, I moved all the projects and solution files to a differently named folder, and the normal status bar "Add to source control" item came back.
My question is, why does moving the files work? There were no hidden .git or .vs folders - this solution had never been added to source control before.
What is it doing? Is there a way to fix this if it happens again without renaming the solution folder?
Additional info: I tried disconnecting from TFS and opening the project I wanted to add, but that had no effect - so I presume that's because it thinks it's using the local git repository?
If I look at Team Explorer once disconnected from TFS, then all remote repositories are disconnected as I'd expect, but the local Git one the common code repository is bold still as the current repository - and there seems to be no way of disconnecting from local repositories?
You may try to clean the cache folder to see whether it helps you. The folder path is: C:\Users\username\AppData\Local\Microsoft\Team Foundation\x.0\Cache.

Pending Changes dialog shows files outside solution that shouldn't be there

If I open VS without opening a project/solution, I get a list of files in Pending Changes. The folders marked in red are solutions in my workspace, and those marked in green are branches of the solution.
However, when I open the respective solutions directly, none of those files are there. Somehow there is some overlap of what VS/TFS thinks needs to be checked in, even though in this case it is wrong.
I opened each solution from Pending Changes in turn, and there are no files to be checked in. I don't understand what (or why) it's showing me this list, and am concerned that if I accidentally check-in while showing "All" pending changes instead of solution-specific ones, that I will lose work.
Can anyone please explain why its showing these "phantom" pending check-ins? Even more bizarelly, the same of the solution in the title bar of pending changes is not even remotely related to some of the files shown.
If I delete my workspace, then create a fresh one, and then get recent, the problem goes away for a few weeks, but then randomly files start to appear back here.
This could be a source control binding error or some TFS cache issue.
Try to unbind/ bind this files in source control. File > Source Control > Advanced > Change Source Control
File > Source Control > Add to Source Control
Detail ways please refer: Project not showing as checked-in to TFS in Visual Studio 2013
Also give a try with clear VS and TFS cache

Visual Studio shows Local Path but folder not mapped

I'm using Visual Studio 2012 and TFS, and I needed to move my folders on my local machine which was mapped to a different directory. When remapping, I was having problems where the folder mappings were getting messed up badly as you could see in "Source Control Explorer" in Visual Studio.
As part of my attempts to fix it (after hours of trying), I removed all folders from the Workspace and removed all folder mapping from the root with recursive checked so nothing would be mapped and no local folders in workspace. However a few subfolders in TFS still show their Local Path setting when viewed in "Source Control Explorer".
To make matters worse, when I try to "Map to Local Drive" in order to remove the setting, it says "The server folder is not mapped". So it says it's not mapped but shows that it's mapped.
I've tried remapping the root again with recursive checked and the prior local path settings stay the same and the Workspace only shows the "root" as mapped.
As a side note, I do have multiple servers that I have to connect to in case that matters.
I'm unable to remove mapping on the folder, what do I do? Does anybody have any ideas?
I was able to get it to work.
The way I did it was by removing all mappings in the root as the original question stated, but for those folders that maintained local paths, I just mapped to a valid directory where I wanted them to be instead of the old path.
While doing this Visual Studio crashed (i'm sure that never happens). I then restarted Visual Studio and then went back to the previous folders with the recently changed mappings and then removed mappings. When I did this, it removed the mappings and said "not mapped". I did this for all the the folders that were messed up.
After all folders were un-mapped, I mapped the root to where I wanted with recursive checked and the problem folders from before were mapped to the new directory.
I think the key was that I had to remove the mappings at the root and then remap the folders and then un-map them again. Throw in a little "designed" crash by Microsoft's Visual Studio (sarcasm intended) and it worked. Thanks for those that provided help.
There is a remove mapping option if you right click on the project and go to advanced.
Have you tried using Team Foundation Sidekicks to view your mappings? You can find all the working folders in your workspace and delete them.
If that doesn't help, try creating a new workspace.

How do I get Visual Studio Team Foundation Server to see I moved code to a different folder?

I moved some code from my c drive to my d drive. When I opened the solution, it told me that:
The solution appears to be under source control, but its binding
information cannot be found. Because it is not possible to recover
this missing information automatically, the projects whose bindings
are missing will be treated as not under source control.
So I tried permanently removing the bindings and downloaded the latest version. Now my changes don't register as pending changes.
I've tried selecting the solution in the Solution Explorer and File => Source Control => Change Source control, but it does not let me bind. Server Name and Server Binding columns have "".
Generally speaking, the location of code on your machine is dependent upon where your workspace is located.
If you move your workspace to the D: drive, then there shouldn't be an issue.
However, if you simply used Explorer to copy the files to the new location, then VS isn't going to be able to maintain the bindings.
From the Workspace Editor you can map the entire tree, solutions or even individual projects to a new location.
First off, put it back and undo the changes.
Then, Go to File | Source Control | Workspaces.
Click on the work space name and then the "Edit..." button.
In the working folders area select the source control folder you want to move and give it a new local folder location.
You will need to edit your Workspaces for TFS Server to know the change that has happened at your local machine. To edit your workspace, in Visual Studio:
ensure you have no pending changes; also copy your source code folder to some location temporarily, just to be safe (you can remove after you are all set)
go to Source Control Explorer
locate the "Workspace:" dropdown
select the item "Workspaces" from the dropdown list (you will get a dialog titled "Manage Workspaces"
if you have multiple Workspaces, select the appropriate one from the list in the dialog
click on "Edit" button (you will get an "Edit Workspace..." dialog)
down below in the dialog, you will see "Working folders" grid
click on appropriate row from the grid and modify the "Local folder" path to set to your new folder location
Sometimes TFS and Visual Studio have issues in getting these workspace changes synchronized. I would always close Visual Studio and re-launch it to get my changes synchronized anytime after I make Workspace related changes.
Hope this helps.
the most crude way here (I don't know if there is any other way)
is to put the folder back to its old location , Check in your changes
then remap the project to the new folder
When you move files/folders to make the moves pending changes you need to use a TFS client to do the moves.
For one or two files the Team Explorer UI is OK, for more the command line is easiest.
See tf.exe rename on MSDN (tf move is an alias for rename). There is also step by step help on using the GUI: Move, Rename, and Delete Version-Controlled Files and Folders.

Resources