The item $/MyTeamProject/Main already exists - tfs

So I have been messing around creating and deleting (read destroying via TfsDeleteProject) in preparation for something I have to do in production soon.
When I try to recreate the sample team project with the same name I have no problem but when I try to re-create the same structure (i.e. creating the Main folder) I get the error in the title of this post:
"The item $/MyTeamProject/Main already exists."
I have tried deleting the team project, clearing my local tfs cache and reopening VS but each time when I try to create the Main folder I get the error.
So something is not getting deleted. Any ideas?
EDIT: I wanted to point out as well that I have removed the physical folders on my local system as well.

Not exactly intuitive because I clearedmy local tfs cache (multiple times) BUT...
After my latest repeat of the steps above (definition of insanity) I decided to do a Get Latest on the team project.
I was then able to re-create the Main folder.

Related

Can't check in changes to TFS

I am having issues trying to check in changes to TFS hosted on Visual Studio Online. Started just last week. I am running Visual Studio Professional 2017 version 15.5.2.
When I try to check in changes, I get this error:
C:\My\Workspace\Path\Project\File.cs: Download of item $/Workspace/Path/Project/file.cs was not completed. Perform a get operation to correct.
Okay, whatever. Sounds simple enough.
So I go to the problem file and do a Get Latest Version.
When I do that, I then get this error:
Source Control Explorer
The network path was not found.
The output in the Output window after attempting the get is this:
Conflict C:\...\...\...\...\...\Program.cs - Unable to perform the get operation because you have a conflicting edit
Automatically resolved conflict: edit: C:\...\...\...\...\...\Program.cs as TakeTheirs
The network path was not found.
I have read a number of posts, and tried a number of things. None have fixed the issue. Things I have tried...
Delete the TFS cached under AppData. Did nothing to help.
Disconnect VS from the TFS project, then delete the hidden $tf folder under my local workspace and then reconnect VS to the team project and re-get everything. The initial re-gets all worked. But once I made some changes to a project and then tried to check it in, it started with these errors again.
Anyone have any other ideas? The next step I see in my future is having to uninstall and reinstall visual studio, but I'm REALLY trying to avoid that.
So, the solution is Deleteing and recreating the workspace.
You will meet similar issues when a workspace is messed up.
Generally, you can try below item to fix such an issue:
Disconnect any instance, close VS, then delete the cache folder located at: e.g. %localappdata%\Microsoft\Team Foundation\7.0\Cache, then restart the VS, connect to TFS/VSTS again.
Remap the workspace to a new folder
Delete the old workspace and create a new one, map it.
By the by, ... I had this issue again today, and had a slightly different fix. When I went to delete my workspace, I found that a prior aborted new project had somehow added additional working folder mappings to my workspace. So I deleted those, after which VS said it needed to restart. So I let it, and now everything seems to be working fine.
Just figured I'd let people know, in case they find that situation, so they needn't go through with the whole other drastic measures, to check this first and try it if it applies.

Visual Studio 2013, TFS is very slow

When I originally installed VS Ultimate 2013 everything was fine but for the last month or so it's been a dog.
The source control explore in my Visual Studio 2013 install is very slow. Just clicking on a node and the act of displaying the node contents takes 20+ seconds.
Everyone else on the team is ok so it's not the TFS server it's just my install.
I assumed it was some addin I'd installed into VS so disabled them but no luck.
Any ideas?
Having tried all suggestions, unloaded all add ons, tried to reinstall VS, removed all extra workspaces etc. the answer to my problem was to unmap my workspace and then remap it.
Problem solved. Not got a clue what the underlying fault was.
In my case, the only way to get rid of the lag was to change my workspace location from "local" to server. You can do this under the advanced options for your workspace.
The 'full blast' solution that worked for me was;
remove workspace
delete all source code
rebuild the workspace
rebuild solution
Only takes a few minutes more than just rebuilding the workspace (see #DaveF's answer) but gave me a bit more confidence that everything hangs together.
Had this happen to me a few times now, so there are some things I'd like to add to the accepted answer.
I work in a place where we have a lot of VS solutions with a lot of files in them. Microsoft's guidelines suggest that you shouldn't be using a local workspace if its going to have more than 100,000 items in it. So you could prevent this problem entirely by:
Not using local workspaces
Making sure never to map enough folders into a single workspace that it gets over 100,000 files associated with it.
Periodically declaring "TFS bankruptcy" and unmapping everything.
For me, the drawback of having to use strict locking and not having offline access makes #1 unacceptable. I'm going to try harder to do #2, but honestly #3 is what I've been living by.
Its kind of like early Windows, where every year or so you had to just reinstall the OS to remove all the accumulated cruft.
Cleaning local folders helped: See 'Team Explorer - Pending Changes', under 'Excluded Changes' it said: 'Detected: 50000 add(s)'. Click it to see path to folders.
This make me crazy too for over six months until I found this instruction. Now, my VSO is fling. Note: this information I copy from somebody. Would like to give them credit but I cannot remember how did I find this.
You can fix this problem of TFS by editing registry.
Navigate to key
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\TeamFoundation\SourceControl\Proxy
and then change value of URL to any dummy website like 'www.abcdummy.com'
Restart VS after editing registry key value.
I had the same problem, it kept me busy for a week or so, but after investigating my complete setup i found the following:
Within my ASP.NET application, i had an image directory and an image cache directory, with lots of images in them. (+200.000). Both were not included in my VS project, but still Visual Studio / TFS tripped over this.
First i found, that when checking in some files (which took over 10 minutes when the problem existed), in 'Team Explorer - Pending Changes', under 'Excluded Changes' it said: 'Detected: 50000 add(s)'.
Trying to get rid of this the 'normal way', by opening that 'Promote Candidate Changes' window and setting these files to be ignored, still didn't do much.
But after moving those image directories to some other location, outside my project, all problems disappeared.
Of course i had to add those moved directories as virtual directories to still see my images.
I cleaned my workspace of unnecessary projects and it ran better. I think vh_click is on to something with the 50,000 ads thing. TFS keeps track of all your edits and over time with tons of projects, undos, and craziness you could amasse a large set of which TFS has to chug. Get out the Clorox, the Comet or whatever else you clean with and dump some junk or move it to some archive folder or backup drive.
Cleaning up the Workspace was the solution for me, when opening visual studio 2015 the Source Control Window will remain in a Loading phase, I had 2 workspaces name and name_1 and I removed both.
No need to delete the entire folder, though , keep in mind that if you do delete the workspace and have the files, you will need to force the get latest to be on the safe side
Getting Latest was soooooo slow. I was using a Colleagues PC and had deleted his Workspace.
After an hour waiting to get latest I got an error and realised my User Account didn't have Full Control on the folder, giving Write Access made Get Latest run x1000 faster:
Just to throw another solution in the mix! I had the same problem which seemed to be caused by several layers of working folders configured in my workspace (some overlapping ones too).
The issue was resolved by going to Manage Workspaces, then Edit and then removing the additional folder bindings.
in short "Run it as an administrator".
No one of those solution does work at all, I even search on this link:
Why is Visual Studio 2013 very slow?
In vain, just do this ONE simple step:
Go to your visual studio path, usually installed on this path:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE namely the file "devenv.exe" , then right click on it, click "Run an administrator" ===> then open your visual studio project.
So, you can just send a shortcut of "devenv.exe" to the desktop to easily run it as an administrator each time.
Have ^_^ Fun
You can keep workspace on local and change your workspace to this. I did that and my TFS speed was great :
1- Remove all mapped folders in workspace "Edit":
2- Change workspace folder to parent all of mapped folders:
I hope it is useful for you.

Computer renamed - TFS Workspace doesn't work now

Had to change my computername and domain. Now I can't access team foundation. I tried this statement to fix it.
tf workspaces /updateComputerName:MyOldComputerName /s:"http://MyServer/MyCollection"
It didn't work. I get the following error "Key not valid for use in specified state."
Not sure what to do now.
It sounds like you may have a problem that will prevent remapping the workspace. However, it's possible that the command isn't quite correctly formed, so try checking the collection URL (I'd expect it to include MyServer:8080), and in versions of TFS 2010 onwards the documentation refers to /collection: rather than /s:
If that fails, then one approach to rescue things is to create a new workspace and delete the old one. You can transfer any edited files you had checked out to the new workspace as follows:
Rename your old source code folder, so you keep a backup
Create a new workspace that maps the (old) source code folder location, and Get the latest version of the code.
If you think you deleted or added files, use a folder-diff utility to find them, and manually re-do those changes.
Now check out everything (right click on the root folder and check it out)
Copy your backed up source code over your workspace folder
Undo checkout on everything. Visual Studio will ask if you want to discard your changes. Carefully choose the "No to all" option. This means it will only discard locks on unchanged files.
You will now have all changed files listed in your pending changes.
Once you're absolutely sure this has all worked, you can delete your backup of the source.
(You can achieve a similar thing by unplugging your network cable to force Visual Studio to go offline, moving your old source code back in place of your new workspace folder, then plug the net cable back in and using File > Source Control > Go Online. This should diff your code to the server and work out what changed. I don't trust this as much as the above approach though)
Once you have the code in your new workspace, you can use the tf command to delete the old workspace to clean everything up.

TFS 2012 : The working folder is already in use after Hard Disk Format

I have referred to a lot of forums and also this so question but my problem is that I have formatted my machine. So I'm not able to overcome this issue. I have tried deleting workspaces from visual studio command prompt and also clearing cache, but I feel this mapping is more on the server-side than local cache, because my machine was formatted. I don't know which file has this old working path saved.
Also I have tried downloading the project into a new working path. I was able to download, but then I don't get the TFS icon against each file. i.e.it's like working offline (disjoint from TFS database). On right click we generally have an option to return online or go online. In this case on right click I get TEAM -> Apply Patch & TEAM -> Share Project
Please help me with this.I had the same problem in my asp.net projects, when I simply downloaded them onto a new working path it worked fine. But this java project in eclipse just doesn't seem to connect to tfs when downloaded into a new path nor does it allow to download in the old path.
Please not I have formatted the machine.So my case is different, so this may not be a possible duplicate of other SO questions.
I did not disconnect or delete workspace before a format(due to lack of knowledge) at that point. May be doing that would never cause this.
All I did is check in all files and re-formatted my windows.
I'd suggest using the (free) tool TFS Sidekicks: http://www.attrice.info/cm/tfs/
This will give you a GUI to view all workspaces (across all users and machines), and delete the obsolete ones.
This is stored on the server, but the tf workspace command should be able to remove it for you. You will probably need to supply it with the correct machine name to find it:
tf workspaces /computer:* /owner:domain\jesse.houwing /collection:http://yourserver:8080/tfs/DefaultCollection
Find the missing workspace (the one that was formatted) and remove it from the server:
tf workspace /delete /collection:http://yourserver:8080/tfs/DefaultCollection workspaceName;domain\jesse.houwing
Do not confuse tf workspaces /remove and tf workspace /delete, the former only removes the registration from your machine, the second removes it from the server.
Or, if the computer name and the username have stayed the same, edit the workspace and delete the paths no longer valid (or update them to their new location) by changing the workspace configuration. Use
tf workspace workspaceName;Owner
to open the dialog to edit your current workspace.
Or use
tf workspaces /updateComputerName /updateUserName
To reassign the workspace from the old computer (iinstallation) or user to the new one.
I tried using the TFS sidekick tool, but even then, ran into access denied error. Then I had to manually clear off the files from this path:
C:\ProgramData\Microsoft Team Foundation Local Workspaces
So this can be alternative, if you do not want to install a tool or your company does not allow you to install software from unknown sources on your laptops due to policies.
This already has a marked answer but my problem was solved without command line or additional software.
I had just recently updated to '15 and I was migrating my workspace folder to another drive as it was getting too big. The error being uninformative as it was, still appeared even after I deleted the workspace it cited...or so i thought. Both VS'13 and '15 by default made the same named workspace but one for each version. I had to reopen '13, and delete that workspace then move back to '15 where it would now let me remap my folder.
Hope this helps someone.
logout from previous user and login by new user.
Copy Project Folder to Another path.
In team Explorer Right click on project and Remove mapping.
Remap Project
go to Control Panel --> User Accounts --> Manage your credentials --> Edit tfs User Name
user name : your TFS user.
I solved it like this.
I had the same problem.
TFS workspace manager throw me this error:
"The working folder \PATH\ is already in use by the workspace my_computer_name name_of_previous_user on computer my_computer_name"
I solved this problem by creating user in TFS server and deleting the previous one.
U can go to TEAM> TEAM PROJECT SETTINGS > SECURITY.
& if u have permission- create your own user.
This is what I did to get it to work using Manage Workspaces in VS:
Click on Show remote workspaces, delete remote workspaces as I was not using them anyway, not sure if this was needed.
Created a new Workspace B and mapped to another folder Y and choose yes to download all files now.
Deleted original workspace A, mapped to Folder X.
Recreate original workspace A and remap to folder Y (wrong folder) and choose Yes to download all files now.
Delete Workspace B
Edit Workspace A, go to Advanced. At the bottom where it says Wroking Folders, change the Local Folder path back to folder X and choose yes to download all files now.
Not sure if you have to do all those steps but that is what I did to finally get this remapped, only took all day.

Latest value = "Not Downloaded"

I have several projects in TFS which visually appear in the directory hierarchy as grayed out. When I browse within the projects in Visual Studio 2010/Source Control/TFS 2010, I notice that all of their contents have a Latest value of "Not downloaded". Normally, I have only seen Latest values of "Yes" or "No".
I have tried all of the varieties of "Get latest" that I know, but I am always alerted that "All files are up to date".
If I try to "Check out for edit", I am not allowed.
When I observe the properties of these grayed out files, they always say Workspace Version = "Not applicable".
How do I fix TFS so that I can download and check out the projects again? My suspicion is that my workspace is messed up, but I do not know what to do to restore/reconfigure it.
I was able to remap the directory to fix my issue. To do this, I
selected (right-clicked) the branch that included all of my code, and selected "Remove Mapping..."
renamed the folder I was mapped to within TFS (you can delete it as well, but I renamed just to keep it during this experimental process)
created a new folder with the original name of the branch I was mapped to in the beginning, and
selected (right-clicked) the branch that included all of my code, and selected "Map to Local Folder".
This process forces a complete re-download of the entire branch. Luckily for me, my branch was only 2GB, so I was able to re-download in about 5-10 minutes.
The reason for getting "All files are up to date" - is that the information on the TFS server and the files on your disk is out of sync. If you delete the files on your disk with file explorer - the TFS server still thinks you have the file on disk. To re-sync you have to force an update like this:
Check the two checkbox on this dialog - and click Get:
It happened to me as well when I added and existing project as a reference to another project.
When I added the project reference I had a pop-up message that told me that the current project already exists at the source control but at a different location then the relative path of the current project.
by a mistake I choose the wrong option which lead to the unnecessary mapping.
In order to solve this issue I've removed the mapping from the workspace.
only after removing the mapping i could get the latest project.
I solved it by following this - remove the work space and then tfs prompted me to download everything again.
https://msdn.microsoft.com/en-us/library/ms181386(v=vs.100).aspx
It sounds like the folders / files in TFS are not mapped to a local drive in your workspace.
In Source Control Explorer, select the "Workspace:" dropdown, then select "Workspaces".
Choose your current workspace form the list that appears, then hit "Edit". Check that the TFS folder $/blah is mapped to a local folder c:\tfs\blah
You should now be able to get latest, check out etc.
I had some weirdness with this after :
updating to TFS2017
updating to VS2017
trying to change my TFS URL to https (gave up and reverted back to http)
So somewhere along the line this broke my workspace such that all my projects were showing as unbound. I was able to do a get latest again. This should not overwrite any files you have changed providing they are writable, but if you have any doubt whatsoever then backup your local workspace before doing get latest. It will ask you to resolve conflicts - so make sure to select 'keep local copy'.
In my case, when the branch was deleted: Right click + Check in, helped.

Resources