Customization and programming tricks by Ronny Van der Snickt

Ghost project in TFS: Project site folder already exists

When I was working with Team Foundation Server and tried to delete and recreate a TFS project I got the following error.

Error
TF30004: The New Team Project Wizard encountered an unexpected error while initializing the Microsoft.ProjectCreationWizard.Portal plug-in.
 Explanation
TF30171: The Microsoft.ProjectCreationWizard.Portal plug-in used to create the new team project could not be initialized and returned the following error: TF30270: Project site folder “ProjectName” already exists.User Action
Contact your Team Foundation Server administrator.

 

—begin Exception entry—
Time: 2010-06-17 10:40:17Z
Module: Initializer
Event Description: TF30207: Initialization for plugin “Microsoft.ProjectCreationWizard.Portal” failed
Exception Type: Microsoft.TeamFoundation.Client.PcwException
Exception Message: TF30270: Project site folder “ProjectName” already exists
Stack Trace:
at Microsoft.VisualStudio.TeamFoundation.WssSiteCreator.Initialize(ProjectCreationContext context)
at Microsoft.VisualStudio.TeamFoundation.EngineStarter.InitializePlugins(MsfTemplate template, PcwPluginCollection pluginCollection)
— end Exception entry —

Short answer:
The problem was the sharepoint site still existed somehow. I could not open the site anymore so I thought it was deleted but apparently sharepoint failed to remove the site complete.

I had to run this on my sharepoint server
stsadm -o deletesite -url http://[SharepointSite]/sites/[ProjectName]
(More information for stsadm can be found here)

Long answer:
I googled this problem and found a lot of blogs but nothing that worked for me. So confidence as I was after my last problem (See my previous post MS CRM 4.0 Setup error asp.net is not installed) I did a search on all dll files and put all files related to TFS in reflector. With reflector I found out that the function Microsoft.VisualStudio.TeamFoundation.WssSiteCreator.Initialize (see log) was calling another function. Microsoft.VisualStudio.TeamFoundation.WssUtilities.CheckSitesExists(). Basically this function used a sharepoint webservice on address http(s)://[SharepointServer]/sites/ [SiteName]/_vti_bin/Lists.asmx to see if a site exists or not. On this web service the function GetListCollection is triggered. If the site does not exist an exception is thrown and TFS knows the site does not exist. In my case the call to the web service did not thrown an exception and I tested this with a console application. (See screenshot below)

So TFS was not to blame (not totally because I find this a weird way to check if a site exists or not) but the problem was sharepoint. When I checked the sharepoint content database (table webs) there was still a reference to the deleted sharepoint site. And this was the reason why I did not get an exception.

Finally after finding this site I tried to remove the site again by executing
stsadm -o deletesite -url http://[SharepointSite]/sites/[ProjectName]

After this I tried my console application again and this time I got an exception. And for once this is a good thing…

I tried to create my TFS project again and this time it worked

So in conclusion don’t think your site is deleted because you can’t access it anymore with a browser but checkout the sharepoint content database in the Webs table to see if your site exists or not.

Write a comment