A week ago I created a solution through Visual Studio. It put the project in the typical place: C:\Users\swoogan\Documents\Visual Studio 2012\Projects
. After sketching out a rough draft, I added the solution to source control. The area in TFS that I added it to is already mapped to another location on my harddrive via a Workspace.
Some time later I went to open the solution from Windows Explorer and I could not find it. I was looking in the local folder defined by my workspace and not my projects folder, as I was thinking about where it is in source control, not where I created it from.
When I looked in Source Control Explorer
it was clear that it was mapped to the Visual Studio 2012\Projects
that I had originally created it in. What I wanted to do was wipe that mapping out and download it to it’s proper location. Somehow TFS was overriding my Workspace mapping.
I quickly checked my Workspace definition for the folder, but it was not listed. VS/TFS seemed to be storing the mapping somewhere else. I vaguely remember that TFS had that capability going back to at least VS 2010. However, I also recall that in VS 2010 you could right-click the folder in Source Control Explorer
and there was a Mappings
option there. Hunting all over the VS 2012 did not reveal similar functionality. I am sure it is in there somewhere, but I could not find it.
I did a brief search online, but the immediate results dealt with manipulating Workspaces. This was a very specific problem and I knew the cause. I also knew finding the solution via searching was going to be tricky.
Therefore, I first decided to try out an idea I had. I figured that if I could disconnect the Projects folder copy and Get Latest
, TFS might re-download the folder to the folder mapped by my Workspace.
There is a hidden “feature” in Visual Studio for unmapping a folder from source control. For whatever reason they did not include a way to do this easily. Once you create a Workspace mapping for a folder and do a Get Latest
there is no obvious way to undo this action. Deleting the files from Source Control Explorer
also deletes them from TFS. Deleting them from the filesystem just confuses TFS; it thinks they are still there.
To unmap a folder from TFS, you must use the Get Specific Version
feature. They have moved this around on various versions of VS, but basically you will find it by right-clicking. It may be buried in the Advanced
submenu. From there you change Version->Type
to Changeset
and enter 1
in the Changeset
field. Finally click the Get
button. This deletes the local files and greys out the folder in Source Control Explorer
.
I immediately noticed that the mapping was gone in Source Control Explorer
and the path that it was listing was the folder that I wanted to use. I was then able to do a Get Latest
on the folder and download all the files to the correct place.
No comments:
Post a Comment