How to TFS-unmap without losing physical files? - visual-studio-2010

At the moment when unmapping a source on TFS Source Control in Visual Studio 2010, the local downloaded files are removed automatically.
How can I keep them untouched?
Nam.

In VS2012
"You can remove the mapping in the Manage Workspaces dialog (File -> Source Control -> Advanced -> Workspaces...) Pick your workspace and select edit, remove the entry for that mapping. Then hit OK. When prompted to perform a Get you can say "no" and the items will stay on your local disk until you next perform a Get."
I added some more information on to it.
Source: Remove Mapping
Just in case anyone else need help with this because i went for hours searching for the solution....and this is the way to see all the mappings you have and remove them if wanted without deleting local files.

I have not seen this behavior. When un-mapping, are you choosing to re-download all files in the workspace? If so, choose not to do that, and the files should be preserved locally. Keep in mind that TFS is no longer tracking changes at that point, so it could get you into a lot of difficulty if you inadvertently make changes to those files.
What kind of process are you trying to implement that you need to keep these files around after an unmap? Maybe there's a different way to accomplish what you need?
--EDIT--
When you're doing this, files are just files, so you could:
do a Get of all files in that workspace
copy them to another folder on your hard drive
map that new folder
Do an "add files" on everything in the new folder structure
check in.
You will have to rebind all of the projects/solutions to source control when you do this.

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.

How to clear Visual Studio workspace

I have a workspace in VS2015 (same problem in 2013) that I'm trying to completely remove and start fresh with a copy from the server. To clarify, I want none of the files or changes that currently exist and I want to start completely fresh with the server copy of all files. I don't know how to correctly do this, however. I've deleted the workspace, the actual files that the workspace pointed to, and I've cleared the cache locations below, but VS still shows that the workspace exists and won't fix itself. In fact, it still shows the mapping even though I've triple-checked that it's deleted.
I'd like to avoid using devenv /reset since I'm pretty customized and I don't want to fix all of it, but I'll do it if it's unavoidable. How can I accomplish this?
Locations cleared/deleted:
%LocalAppData%\Temp\<all VS files/folders>
%LocalAppData%\Microsoft\Team Foundation
%LocalAppData%\Microsoft\VisualStudio\<version>\ComponentModelCache
On the window where you can get a specific change set from TFS, get the changeset with id "1". This is the situation just before the project was created - empty!
Right mouse om project node in solution explorer
Source Control > Get specific version
Version type "change set"
Input change number "1" (without quotes)
Click "Get"

Mark a large number of files as Build Action "None" in Visual Studio

I have a folder containing 12000 images. When I add them to my project they get marked as Resources, but I want to set their Build Action to None. If I select them all and go to the Properties tab and set None, VS starts working and engulfes itself.
Is there another way to do that? Or a way to set the default Build Action for newly added files to None?
Thank you!
Make a backup of your project file (e.g. by committing it to a branch in source control locally) before making manual changes to the file.
Right click the project node in Solution Explorer and click Unload Project.
Right click the project node in Solution Explorer and click Edit yourproject.csproj.
Replace all instances of
<Resource Include="Resources\
with
<None Include="Resources\
Save and close the project file.
Right click the project node in Solution Explorer and click Reload Project.
Optionally you could also remove all instances of these lines and use the following single line instead. You'll definitely want to mark your place in source control so you could undo the change if it doesn't work out like you expect.
<None Include="Resources\**\*.jpg"/>
12,000 files is a good two orders of magnitude beyond what you can reasonably expect to be performant during a build. Just checking if files need to copied can easily take 5 minutes on a spindle drive. Still uncomfortable on a solid-state drive.
You'll need a drastically different approach to solve this. Key approach is that you don't wait for it so cannot get annoyed at the delay. Like spinning this off into a separate project that builds a resource DLL, not included in the solution. Preferably done on another machine, build servers are good for that. Or a completely different approach to packing the files, like sticking them in a ZIP archive. A "wad" in gaming speak of old. Or taking your program to the files instead of the other way around, keeping them stored on disk and telling your code where to find them with a configuration setting.

Copy a TFS mapped solution directory on desktop to work offline

hello i want to make a copy of my TFS solution to avoid the control of source code.
i mean to have 2 same solutions, one on tfs and one other without tfs.
tried to copy mapped folder solution on my desktop and VS 2010 return a message everytime as
1. work temporarily offline
2. remove permanently the solution
If you are sure you are working on the 'copy' then you can remove the source control bindings safely. If you have picked the wrong one, use the source control window to roll back the change.

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