Building your SharePoint Apps using the new scriptable build in VSO


This post is about Team Builds and the new build system for Visual Studio (Online) that is currently in preview. If you are new to team builds or not sure why you should use them, you might want to check my earlier post about Application Lifecycle Management for SharePoint People. Especially the part about local builds being plain evil 🙂

Visual Studio (Online) has a new build system!

Although still in preview this new system has some compelling features compared to the current XAML build system. For one, it is truly web based but more importantly it targets cross-platform applications in a way the XAML build definitions never did. If you would like to know more, see the feature overview:

If you would still like to use the XAML build definitions, you can… for now at least.
Compared to the XAML build definitions, creating a build for SharePoint Apps is quite a lot easier. You don’t need any custom build tasks or post-build PowerShell scripts to create the app package and can extend the process with customizable build steps. In this post I show you how to setup a simple SharePoint App but you can extend it to manage the more complex build scenarios such as CI or support your Release Management process.
To be able to make use of the build system, you need to get hold of a Visual Studio Online account. You can create one for free on if you do not already own one. Each of these free accounts will get you:

  • 5 free Basic user licenses
  • Unlimited stakeholders
  • Unlimited eligible MSDN subscribers
  • Unlimited team projects and private code repos
  • Free work item tracking for all users
  • Free 60 minutes/month of build
  • Free 20K virtual user minutes/month of load testing

After creating your account, first thing you need is to setup a project to hold at least the source code and build definitions. You only need to supply a few basic settings, like project name and version control system. Pick anything you like, the process is the same for both the process templates and version control systems. If you don’t know what to use, I would suggest Scrum and Git.

New VSO Project


If you already have a SharePoint App project in Visual Studio you need to add it to source control to be able to build it using the Hosted Build Controllers. See for more information on how to accomplish this task. If you don’t, you can set one up right from the Visual Studio IDE:


In this case I will pick a simple SharePoint Hosted App, but you can use the same process for Provider Hosted Apps. After the first “Commit” and “Sync” (Git Pull + Push) the source code should be available on Visual Studio Online:


Now that our source code is available, we can start creating our first scripted build.

Step 1: Create new build
You access the build system from the navigation menu at the top:


This page allows you to manage both your XAML builds and the new scripted builds. If you now click the “+” sign, you have several build templates to choose from (including an emply one), but the Visual Studio template will do just fine for most projects:


We are now presented with the actual build configuration. From the template we already have 4 steps present, but for the sake of this sample we can remove both the Visual Studio Test and the Index Sources & Publish Symbols step. This leaves us with only 2 steps to configure:

Step 2: Visual Studio Build Configuration

Here we need to supply some specific build arguments to be able to build and package SharePoint Apps. If you are already familiar with building SharePoint Apps with XAML templates, you will probably recognize them. One thing to note: you do not need to specify the publish directory (“/p:PublishDir”) because that has been taken care of by the next step.

The following arguments are needed:

  • /p:IsPackaging=true
  • /p:AppSpecificPublishOutputs=true
  • /p:VisualStudioVersion=12.0


Step 3: The Publish Build Artifacts Configuration

The next step takes care of publishing the build output to the drop location so we can access the results. In our case, we need at least to add the “.app” package.


Now we can save and run our build!
Step 4: Running the build
Now that we are all done configuring, we can run our build right from the Visual Studio Online UI. You can do this by choosing “Queue build…” from the context menu or page:


Here you will notice one of the new features of this new scripted build system: instant detailed feedback on the build process through a nice looking console!


If all goes well, you now should have a SharePoint App build by Visual Studio Online! If not, you have access to high detailed logs, right from this Build Result page. To access the artifacts, you can navigate to this build summary by clicking the top left build item:


If you then navigate to “Artifacts” you can download or explore your drop folder which should contain your SharePoint App package:


Happy building (with VSO)!