Adding a project to Team Foundation Service

Over the weekend I spent a few hours building a demo web application, and I wanted to deploy it to an Azure website. So I set up a Team Foundation Service project, and a new Azure website linked to that repository. The beauty about setting it up this way is that every time you check your code in to TFS, it automatically builds and (depending on the success of the build) deploys your code to the Azure website, giving you Continuous Integration pretty much straight out of the box!

In theory this should have been a relatively simple thing to set up. I’ve done it a few times before and I use TFS on a daily basis. However this time something went badly wrong and it took me quite some time to get this demo website checked in to TFS!

Here’s a few things I learned during my epic struggle with TFS:

  • It’s really difficult to add a local project to a TFS project (or at least it was for me!)
  • It’s really difficult to delete a project from TFS once you’ve created it! (check this article I found which explains how to do it)
  • It’s a very bad idea to delete the .vssscc file that sits in your solution’s root directory! This is the source control file that TFS uses, and deleting it causes all sorts of problems…
  • At the point you start getting into a mess with any source control repository, it’s easier to create a new project and start again than it is to try and figure out what’s going on!

Finally I figured out how to make this work, so here’s how to create a TFS solution that continuously builds and deploys to a Windows Azure website:

1. Log in to your TFS account and click on ‘New team project’. You will see this screen. Enter a project name and description (optional), and click on Create Project.


Create a new project in TFS


2. Now open up Visual Studio and click on ‘Create a new Project’. On the ‘create new project’ screen in VS2012 there is a checkbox ‘Add this project to Source Control’


Create a new project in VS2012


3. Visual Studio will now create your project, then show this screen which lets you choose which TFS project to add your new local project to


Add your local project to TFS


4. Choose the project you want to use, and click OK.


5. Finally in Visual Studio, open up Team Explorer (View > Team Explorer) and click on ‘Pending Changes’. From this screen you can add a check-in comment and check in your new project code to TFS!


VS2012 Pending Changes


So there you go – easy when you know how!
Tagged with: , ,