Team Build 2010 Customized Output Directories & SharePoint 2010 WSPs


 

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 Smile.  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….

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.

Customizable Output Directories for TFS 2010 Build

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

Build Definition

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.

<!-- Customizable Output Directory Opt-In for TFS Build (web application projects) --><PropertyGroup Condition="$(TeamBuildOutDir) != '' ">  <OutDir>$(TeamBuildOutDir)</OutDir></PropertyGroup>

If you’ve followed all the steps so far you should be receiving the following error when the build definition is triggered:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets (389): Unable to get the assembly for SharePoint Project Item

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

Microsoft.VisualStudio.SharePoint.targets

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:

Build succeeded

You should be able to locate the WSP in the drop folder as shown in the screen capture below:

Team Build 2010 Drop Folder SharePoint 2010 .wsp

Hopefully this helps someone else trying to better organize their drop folder.  Let me know how it goes!

About Wes MacDonald

Wes MacDonald is a DevOps Consultant for LIKE 10 INC., a DevOps consulting firm providing premium support, guidance and services for Azure, Microsoft 365 and Azure DevOps.

7 Responses to “Team Build 2010 Customized Output Directories & SharePoint 2010 WSPs”

  1. Hey Wes, get tutorial. I found another and followed it, but yours give a better description of what to do. Anyhow, I’ve made the changes as you’ve described, but I’m getting another error:
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets (411): Method not found: ‘Boolean Microsoft.VisualStudio.SharePoint.PathUtils.HasIllegalDeploymentPathCharacters(System.String)’.

    I’m not quite sure what that means. I have multiple projects in my solution and I’ve added the opt-in for them to build separately in their own folders. Do I need to remove this opt-in for all projects in the Sharepoint solution or does it matter?

    I’d appreciate any kind of input that you may be able to provide. Thanks!

    Like

    • I would turn up the logging on the build to see if you can get more information on this error and then review the log. In your build environment I would verify the required files are actually present or it could also be due to a space in the path name…

      Like

      • I do have spaces in my path names. However, I’m not quite sure where I’d go about fixing that. I just cranked up the build logging verbosity and dropped some tags in the targets file to see if I can get any more info. I’ll let you know what I find in about 5-8min :).

        Like

      • Verbose logging didn’t help. I don’t know if diagnostic mode will help.

        The target it is failing on is PackageFiles. There are two properties: LayoutPath and PackagePath.

        LayoutPath=pkg\Debug\abc.xyz.Core
        PackagePath=C:\Builds\1\TeamProjectName\Build Definition Name\Binaries\abc.xyz.Core.wsp

        The outputDirectory that is passed to MSBuild is: C:\Builds\1\TeamProjectName\Build Definition Name\Binaries\

        I’m really at my wits end on this one!

        Like

      • There were two projects that should output a wsp file in the solution. I made one of them not build by removing it from the build configuration. The other project gives the same error. So much for it being something with that project. Oh, well. So much for CI and packaging!

        Like

      • I am sending you an email shortly with some screenshots. I reviewed the configuration of my SharePoint 2010 Build Server that I used for the post. It appears you do not have the correct assembly. The assembly Microsoft.VisualStudio.SharePoint.Tasks.dll on my system is dated 2/19/2011 and has the particular method you claim to be missing.

        Like

Trackbacks/Pingbacks

  1. August 8, 2011 – Learn TFS Daily | Learn TFS - August 10, 2011

    […] Team Build 2010 Customized Output Directories & SharePoint 2010 WSPs from Wes MacDonald If you are doing SharePoint development, you can utilize Team Build 2010 to build and deploy your SharePoint components. Here, Wes shows you how to organize your drop folder when building SharePoint projects. […]

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.