Here is a great resource on how to build team projects for SharePoint in TFS 2010 (also lists steps for TFS 2008).
http://msdn.microsoft.com/en-us/ff622991.aspx
Quick reference excerpt from the article below:
Install the SharePoint assemblies:
If your project refers to other SharePoint assemblies, copy them to the build system too.
Install the SharePoint tools targets and tasks
Install the SharePoint tool assemblies:
Build and package the SharePoint projects.
In TFS2010, this can be customized through the UI of the Build Definition. Under the Compilation category, in the MSBuildArguments field, add the following script:
/p:IsPackaging=True
For TFS2008, when you queue or start a build, you can add the script to activate the package task in the MSBuild command-line arguments text box:
If you want the package be created every time the build definition is used, add the script to the generated build file.