TFS Team Build


I’ve been looking at TFS Team Build in the last week or two. Up until recently we used TFS 2005 along with VS 2008. However, the MSBuild files generated by VS2008 are not fully readable by TFS 2005 – understandable, really. This meant that we could not do team builds. I read (and tried, with some success) some workarounds, but now we have TFS 2008, so I’ve been trying it out “properly”. I’ve gotten some good results with it, doing automated unit tests and nightly builds as part of the build, creating work items for failed builds etc. etc.

What I have really wanted to do, however, was to integrate the new Database project (formerly Data Dude, and now integrated with VS 2008) with Team Build. I’m using the GDR version, and have managed this weekend to get a full deploy of a database as part of the team build. From this one could e.g. run unit tests etc. against the newly-created database.

I surfed around for ages without much luck, but then stumbled onto the following page:

http://msdn.microsoft.com/en-us/library/aa833289%28VS.80%29.aspx

The main part of interest is to modify the Team Build project file (which lives in TFS) as follows:

 

   1: <Target Name="AfterDropBuild">
   2:   <MSBuild Projects="$(SolutionRoot)\SolutionName\ProjectName\ProjectName.dbproj" Properties="Configuration=Default;OutDir=$(SolutionRoot)\..\binaries\Default\" Targets="Deploy" />
   3: </Target>

However, I had to change the path to not include <solutionname>, as this was included in the solution root. In addition, I had to change the binaries file from Default to Release (or whichever your release configuration is called).

Once you’ve done this, you have to go into Visual Studio and change the connection string in the Properties of your Database Project, and changing the database connection (NOT your isolated sandbox environment) to point to where you want the integration test database to be deployed to. I have also set it to tear down the DB completely every night, although I may change this at some point.

And it all works great!

However, I’d still like to find out how to: –

  1. run data generation plans as part of the nightly build (and on the right database!)
  2. configure the app.config post-deploy to point to the new database
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s