TFS and Sharepoints solutions for deployment

Struggling to get Sharepoint work together with TFS? Getting it to work with Visual Studio 2005 solutions can be painful enough. Luckily Andrew Connel has made a post about the latter - he carefully explains what you need to do, step by step.

Unfortunatly, his solution cannot be transferred directly to a team solution. We need to do a slightly different apporach:

Team development

If you are working in a team development, you are bound to be a lot of folks (at least more than two...:) and have a lot of projects and/or solutions. Eric Charran has written an exellent document on team development. (If you need guidance on team development environment, read his document before you continue.) He separates Sharepoint Designer files (content db files) from TFS. In many situations that is a fully valid choice, but then again sometimes you have different needs. I would like to build my solution on a build server, get a set of .wsp files and install my .wsp files with a script. This will make solution deployment to dev. machines and various test machines a lot easier.

Solution structures

So, I would set my solutions up with one project per item type (content type, xml feature, web part, etc.) Each project would then include feature defintions for each item that needs to be installed.

The projects with code to be compiled, would be added to a seperate "TFS_build" solution (this is a "normal VS solution, got nothing to do with team build types on the TFS).

Diamond definition files

Each solution must include a .ddf file. These files defines which files to include in the cabinet (.wsp) file.

Build project on TFS build server

Create a TFS build project in TFS. The TFS build project should be set to compile the "tfs_build" solution. Then you must add target definitions for using makecab on all projects - in order to build one .wsp file for each solution.

Local build

You can also set up your projects for local builds. If you unload your projects and define a MSBuild event. (Like Andrew explained). You might need a seperate .ddf file for local builds. I'm not quite sure on using the same relative paths on both TFS build server and local dev machine. Creating a second _local.ddf file works fine though. The only thing is that you now must update two places...

Deployment

You should now have a set of .wsp files. Copy them locally to your server and use stsadm to install and deploy.

 

btw. This was my first post with Windows Live Writer Beta, but definetly not the last! Great tool - go download it!!