TFS and SharePoint Builds including Automatic deployments – Part 1

6 minute read

Part 1 of this series will instruct how to configure your build server for building SharePoint projects. In Part 2 we will discuss the automatic deploy options. Part 1 of this series is based on the following MSDN article How to Build Office Developer Tools Projects with TFS Team Build 2012. In this article there are some mistakes and are corrected here.

When user are using Frameworks like SCRUM you also have to look into automatic builds and automatic deployments to your test and acceptance environments in order to not lose a lot of times with you deployments.

Setting this up is quite some work. First off all you need to configure your build server in order to even be ready to build SharePoint projects. In this article we will go trough each step to configure your build server to build your SharePoint projects.

  1. Install TFS Team Build
    If your build system already has TFS Team Build installed on it, you can skip this step. Otherwise, install and configure Team Build on your build system.
  2. Install Windows SDK
    The Windows SDK must be installed on your build system because it includes the GACUtil tool. GACUtil is used to install the SharePoint Tool assemblies on the build system. You can download the Windows SDK from this location: http://msdn.microsoft.com/en-us/windows/bb980924.aspx. After you download the Windows SDK, install it.

When installing the Windows SDK you can encounter the following error:

Installation of the “Microsoft Windows SDK for Windows 7″ product has reported the following error: Please refer to Samples\Setup\HTML\ConfigDetails.htm document for further information

Looking at the log files you will see these two entries:

DDSet_Error: Patch Hooks: Missing required property 'ProductFamily': Setup cannot continue. 
DDSet_Warning: Setup failed while calling 'getDLLName'. System error: Cannot create a file

This is because the Windows SDK installer is having problems with a currently installed component. Remove this component and it will work fine:

  • Visual C++ 2010 runtime

After that you can also install the Visual C++ 2010 Service Pack 1 Compiler Update

  1. Install Build Support for Apps for Office and Apps for SharePoint
    To build apps for Office and apps for SharePoint projects, several components must be installed on your system.
  1. Install SharePoint Farm and Sandboxed Solution Build Support
    Since SharePoint farm and sandboxed solution projects reference SharePoint Server assemblies, those SharePoint assemblies must be present on the build system.
    One way to do this is to install the full version of SharePoint Server 2013 on your build system. An advantage of having SharePoint installed is that you can use it to deploy and test your SharePoint application immediately after generating the WSP file. Note, however, that SharePoint Server 2013 can degrade your system performance, and it has increased system requirements (such as requiring a 64-bit CPU).
    As an alternative, you can download the required SharePoint assemblies onto your build system. For either method, you will need the proper license of SharePoint on the build system. Copy the following assemblies from the development system to the build system and put them in a Reference Assembly folder:
  • Microsoft.SharePoint.dll
  • Microsoft.SharePoint.Security.dll
  • Microsoft.SharePoint.WorkflowActions.dll
  • Microsoft.Office.Server.dll
  • Microsoft.Office.Server.UserProfiles.dll
  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll
  • Microsoft.SharePoint.Client.ServerRuntime.dll
  • Microsoft.SharePoint.Linq.dll
  • Microsoft.SharePoint.Portal.dll
  • Microsoft.SharePoint.Publishing.dll
  • Microsoft.SharePoint.Taxonomy.dll
  • Microsoft.Office.SharePoint.Tools.dll
  • Microsoft.SharePoint.WorkflowActions.dll
  • Microsoft.Web.CommandUI.dll

        These files are located in the following folder on the development system:
       C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI
        It is recommended that you copy the SharePoint Server assemblies to the folder:
                .. \Program Files\Reference Assemblies\SharePoint\
        And then add one of the following registry entries:

The Microsoft articles tells you to place the following registery key but it should be the one below.

  • Wrong:
    HKEY_LOCAL_SYSTEM\SOFTWARE\Microsoft\Wow6432Node\.NETFramework\v4.0.30319\AssemblyFoldersEx\SharePoint15]@="<AssemblyFolderLocation>"
  • Good:
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\SharePoint14]@="<AssemblyFolderLocation>"

You could also use the following “reg” file to import the setting to the following location: "C:\\Program Files\\Reference Assemblies\\SharePoint\\".

        If your SharePoint Projects refer to other SharePoint Server assemblies, copy them to the build system as well.

  1. Install Office Developer Tools Assemblies to the GAC

In order accomplish this step you can do two things. When you already have Visual Studio 2012 installed install de developer tools or add all the right assemblies to the system.

Install developer tools

Open the Web Platform Installer and install the Microsoft Office Developer Tools for Visual Studio 2012. You will need to make sure you have installed the Service Bus 1.0 Cumulative Update before installing the developer tools.

Right Assemblies for the system

If you do not have Visual Studio Installed on the system you should follow the following steps:

The following assemblies must be copied to the GAC of the build system:

  • Microsoft.VisualStudio.SharePoint.Designers.Models.dll
  • Microsoft.VisualStudio.SharePoint.Designers.Models.Features.dll
  • Microsoft.VisualStudio.SharePoint.Designers.Models.Packages.dll
  • Microsoft.VisualStudio.SharePoint.dll

These files are located in the following folder on the development system:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\
If you also need localized versions of the files, you should also copy and install the corresponding resource DLLs to the GAC of the build system:

  • Microsoft.VisualStudio.SharePoint.Designers.Models.Features.resources.dll
  • Microsoft.VisualStudio.SharePoint.Designers.Models.Packages.resources.dll
  • Microsoft.VisualStudio.SharePoint.Designers.Models.resources.dll
  • Microsoft.VisualStudio.SharePoint.resources.dll

Next up is installing the required MSBuild dependencies. Copy and install the following custom targets and tasks folders to the corresponding folders on the build machine:

  • .. \Program Files\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools
  • .. \Program Files\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications
  • .. \Program Files\MSBuild\Microsoft\VisualStudio\v11.0\Web
  • .. \Program Files\MSBuild\Microsoft\Workflow Manager\1.0

(For 64-bit systems, use "\Program Files (x86)" in the path above.)

As last Install Workflow Dependencies to the GAC

  • Microsoft.Activities.Design.dll

The file is located in the following folder on the development system:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\

  1. Create a package for the Office Developer Tools Project

When you also want your project to be packages you need to supply the following MSBuild argument to your build Definition:

  • /p:IsPackaging=true