Can I recover my source code after I use TfsDeleteProject?

Surprisingly, you can, at least in Visual Studio Team System 2005 (including SP1). If you’ve deleted your team project using TfsDeleteProject, the source code files are still actually there in the database, just not visible any longer. To recover the files, you’ll need to create a new team project with the same name as the deleted team project. Once the new team project is created “POOF”, you have access to all your old source code. (You’ll need to check the “Show deleted files” checkbox in your source control options, otherwise you won’t see the files in the Source Control Explorer.)

Please note that this will not work in Visual Studio 2008 (Orcas) and beyond.

Update:  As Steve Shippee mentions in the comments, this will NOT recover your documents stored in SharePoint!  It only recovers those documents stored in version control.  (Which brings up a practice I believe is good — backing up your SharePoint documents to TFS Version Control at the end of every iteration.  But that’s for another blog post.)

Thanks, Steve, for that vital point!!!! 

About Steven Borg

I'm a technology geek with a strong passion for process, teamwork and the "soft" skills that drive excellent software development teams. Over the past few years I've experienced both brilliant and abysmal software teams. My goal, right now, my burning desire is to improve the lot of the coder. Working in a good team is exhilarating, energizing and fun. It is also far more productive than the alternative. No developer should be left in a poor development team, not when they can be turned around. Turned around and made great!
This entry was posted in FUQ, Visual Studio Team System. Bookmark the permalink.
  • steven.shippee

    What is assumed from this post is that we all recognize that any and all documents that were in the Share Point realm will be gone – no small condition given that Share Point is where most documents pertaining to collaboration would have been residing?

    Steven Shippee