Monday, June 20, 2011

How to 1 : Deploy SharePoint 2010 Solutions (WSP) files from Team Foundation Server 2010 Build

This article is a two part series which will explain how to Configure Team Build 2010 to Build a SharePoint Solution package and then deploy the solution package to a SharePoint server. In this scenario the build agent is running SharePoint Foundation 2010.

Step 1: Prepare the Build Machine
There are lots of good articles on MSDN which cover the basics of setting up a Build Environment. Once you are done preparing, the best pen test I have come across is to login to the build machine (as the build service account) and set it up exactly like you were going to develop on it. For instance, you would want to install:

•· SharePoint Foundation 2010 – or SharePoint Server 2010, whatever your shop is developing against
•· Visual Studio 2010 + Extensions for SharePoint Products
•· Any additional 3rd party libraries you use like NUnit
•· Grab the latest solutions and project files from Team Foundation’s Source Control
•· Configure the project to deploy to the server and try to deploy your solution
•· If everything builds, you are ready to proceed with deployment automation
Rather than re-create the content for creating a custom build I would recommend you take a look at this series of posts from Ewald Hofman. He put together some great information on customizing the Team Build process. I HEAVILY relied on his tutorials to get the build process going. You can either read his posts, specifically Part 1, Part 2, and Part 14. Or, I am going to attempt to summarize the necessary steps below. Now that the build machine is ready, let's move to the next setup.

Step 2: Wire Up a Basic Build
First we should make sure the build works. Navigate to Team Explorer and right-click on the Builds node for your project: choose New Build Definition…


Name it Build SharePoint, click on the Build Defaults section. Choose your Build Controller from the dropdown and put in the UNC path for where the built files will be placed. Leave the defaults for Triggers. If you don’t already have a workspace setup, then configure the locations for the projects you are going to build.

Click on the Process tab.


Verify the correct solution or project is selected in the Items to Build field. Go ahead and Save the Build and queue up a new build. It should output the assemblies for your project/solution into the drop folder.


Once the build finishes go ahead and double click the build to see the entire overview. Click the Open Drop Folder to view the output of the build. You might be asking, "Where is the Solution file?." That is our next task.


Step 3: Get a Solution Package
Right-click on your BuildSharePoint from Team Explorer and choose Edit Build Definition.


In the Process section, expand the Advanced grouping. Find the MSBuild Arguments field and enter /p:IsPackaging=true. Save the build definition and queue up another build. This time you should have a nice .wsp file in your drop folder.

No comments:

Post a Comment