TFSDeleteProject.exe fails to delete projects which fail in their creation but are partially in existence
Saturday, October 22, 2005 9:22 PMI posted a bug for this on the bug reporting site:
MS say they have fixed it in v1, however, does anyone know how I can remove projects manually from source control or reporting services manually for an orphaned project?
Saturday, October 29, 2005 5:23 AMModeratorTry TfsDeleteProject again with /force - that will continue trying to delete the other parts even when it fails to delete on one of the parts.
Tuesday, April 04, 2006 8:13 PMIn RTm release we have projects like this that we are trying to clean up and "/force" or not we still get the error "The project '<project name>' was not found on the Tfs Server." How can we get rid of these Orphaned folders in source control. (It's no problem if its the sites and reports servers get orphaned because there's an alternative way to delete them, but what's our alternative in Version Control?)
Tuesday, April 04, 2006 8:20 PMModerator
First, confirm the server project list doesn't see them (you can use ListTeamProjects).
Assuming they're not listed there, you could try creating each as a team project again, but during the team project creation wizard, select the option to not create the version control folder. Make sure the names match exactly (on case as well)
Then, after each of those is created, delete them - the version control folders should be deleted as well.
Tuesday, April 04, 2006 8:25 PM
I'll quick get your code sample running to try this, but doesn't the fact that the projects are visible in Project Explorere (from any client) confirm that the server sees them? Then what?
Tuesday, April 04, 2006 8:28 PMModerator
The output of ListTeamProjects and then TfsDeleteProject on one of the projects would be helpful - that should help detail what's going on.
Tuesday, April 04, 2006 8:50 PM
Well interestingly enough, ListTeamProjects did not return any of the root folders in question, only the one "WellFormed" project that is there. Unfortunately the creation of the team project failed with the duplicate name error. Finally, the TFSDeleteProject command returns "The project '<project name>' was not found on the Tfs Server." We could really use a next step on this being that we are on the eve of rollout with this.
I might also add that these projects in Version Control are only visible if I login under the tfssetup account. Other accounts aren't able to see these folders. (and yes "Show deleted items in the Source Control Explorer" is unchecked)
Tuesday, April 04, 2006 9:02 PMModerator
Are you trying TfsDeleteProject as the tfssetup account? (if not, can you try that?)
What's the full output from TfsDeleteProject?
Can you send me (email@example.com) the project creation log from trying to create it?
Is the duplicate name coming from Reporting Services or Sharepoint? (If so, you should try just removing them manually and re-attempting the project creation)
Tuesday, April 04, 2006 10:12 PM
Yes, I am logged in under the tfssetup account. The full output form TFSDeleteProject is "The project 'SurveyExport' was not found on the Tfs Server"
I have sent you my project creation log.
When attempting to get to where the SurveyExport site would be on sharepoint sharepoint responds: "the Web site that is referenced here is not in the configuration database". And there is no sign of a folder for reports for this project on http://<server name>/Reports/Pages/Folder.aspx.
Tuesday, April 04, 2006 11:14 PMModerator
We have a bug in our V1 code such that even if you choose "don't create the folder", we still check for it existing and fail team project creation if it already exists. Because of that, we need to do 1) the project creation as a user that can create team projects but doesn't have permission to see the folder and 2) delete the team project afterwards as a "normal" admin user.
In order to delete an orphaned folder (we'll call it $/OrphanedFolder)
You'll want to create/add a user (that's *not* in the Team Foundation Administrators group), such this user has the CREATE_PROJECTS permission in the Team Foundation server ("Create new projects" in the UI under right-click on the server in Team Explorer -> Team Foundation Server Settings -> Security) and admin in Reporting Services and Sharepoint only.
Then, as a normal Team Foundation admin (for instance, TfsSetup), you'll deny Read permission to that folder ($/OrphanedFolder) for the above user.
At this point, you'll be able to create the "OrphanedFolder" team project as this new user. Since they don't have Read permission, they'll be able to bypass this "does the folder already exist?" check. You'll still need to make sure to select "don't create the folder" during the team project creation.
Finally, with the team project created again, you'll be able to delete the team project as a normal TF admin (TfsSetup) and that should take the $/OrphanedFolder with it.
A huge thanks to dzimmy for all his help! Note that these steps worked for him, so hopefully they'll work for others in this situation as well.
Wednesday, April 05, 2006 5:00 PM
We ran into one last issue in this process I thought I would share. On some of the machines, the deleted projects were still appearing in the source control explorer. (Even attempting to do a "New Team Project..." on those boxes and creating a project with the exact project name that had been deleted failed with a permissions error halfway through the process.) We tried refreshing at the root, and doing a get latest at the root, and even deleting the client cache to no avail.
It turned out that by deleting all the workspace working folders on that box, the projects disappeared from the source control explorer and we were able to do all of the above again (new project and deleteproject) without errors. Not sure why, but for what it's worth...
Wednesday, December 05, 2012 8:09 PM
Solution Found (worked for me):
I was able to delete a corrupt TFS project using tf destroy, example:
>tf destroy $/MyCorruptTfsProject
(Error: TFSDeleteProject returns "TF20016: The following project does not exist:..."; Solution: ">TF destroy $/MyCorruptTfsProject")