Before we get started, if you need help configuring your Team Build 2010 Server to support SharePoint 2010 please refer to the following documentation on MSDN. If you already have a developer workstation with SharePoint 2010 and Visual Studio 2010 this script will collect all the required files for you to install on your build server.
You can of course simply install SharePoint 2010 and then Visual Studio 2010 together on your build server and be done with it . I have also applied SP1 to Windows Server 2008 R2, Visual Studio 2010, TFS 2010 and SharePoint 2010 in this environment.
Now onto organizing your drop folder. There are a few solutions out on the web with the promise of customized outputs….
- Control where the build system places your binaries
- Customizable output directories for TFS 2010 Build
- Customize Binaries folder is TFS Team Build Part 2
The method I chose to use for this particular blog post was this one by fellow MVP Ed Blankenship.
I made a copy of the DefaultTemplate.xaml and customized the build process template as per Ed’s blog post.
I have configured my Build Definition as follows (My solution file has the following project types: MVC 3, Web Deployment, Windows Service, SharePoint 2010 Visual Web Part and Web Site Project).
You must ensure you have the correct build process template selected, set the CustomizableOutputDirectory parameter to TRUE and in the MSBuildArguments field, add the following: /p:IsPackaging=True
The SharePoint Project (.csproj) must opt-in to use this new functionality by using the same method as you did for a Web Application. Unload the project file and edit the .csproj to include the lines shown below and then save it and check-in your changes.
If you’ve followed all the steps so far you should be receiving the following error when the build definition is triggered:
On the build server you have to update the Microsoft.VisualStudio.SharePoint.targets file (make a backup copy first). This file is located in the following folder “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools\”.
Go to line number 366 “<CreateSharePointProjectService Configuration=…” shown in the screenshot below
Change the attribute OutDir=”$(TeamBuildOutDir)” to OutDir=”$(TargetDir)” and save the file. Trigger a new build of your solution and the result should be as follows:
You should be able to locate the WSP in the drop folder as shown in the screen capture below:
Hopefully this helps someone else trying to better organize their drop folder. Let me know how it goes!