Setting up an integrated build and deploy pipeline for LightSwitch applications (part 1)


This is a first post of a series on building and deploying LightSwitch apps in automated way.

This post will cover the basics: setting up a build script for building a LightSwitch project on a build server and generating the web deploy package.

Some familiarity with Team Foundation Server and the build process is assumed.

The Prereqs

Team foundation Server

Obviously, you need access to team foundation server. The most easy way is to take an account on TFS in the cloud. See:

The build server

Here we have two options. The first option is TFS in the cloud, which allows you also to use the TFS hosted build controller. That means you don’t need an on premise build server. Cool, but it has also a few drawbacks. The most important is that you can not experiment with the latest LightSwitch bits, which I like to do. I’m currently working with the Visual Studio 2012 update 2 CTP 4. Obviously, the build controller in the cloud does not have these latest bits installed. That brings me to installing yourself a build server and that’s what I did. I installed one on an Azure Virtual machine. So, to really confuse you: my on premise build server is hosted in the cloud :) If you don’t know how to setup a build server, google it !

Start new Project

Create  a simple LightSwitch test application:


Create some tables and some screens and check it in, in TFS.

Run once through the publish wizard

The idea is that we generate package on disk, which will be eventually available in the build drop location. The most important screen in the publish wizard is the following:



Check in the _Pvt_Extensions folder.

I know, you will (I did as well) forget this, and you will get compilation warning (and deployment errors) if you forget.



Check this in again in TFS !

Create a build script

Go the build window and click “New Build Definition”:






We need to provide some information:


Leave General en Trigger for what it is and update the Source settings as follows:





Make sure to point “as narrow as possible” to the solution parent folder in source control.

In the build defaults step, select your build controller and select to copy the files to the drop location in TFS.




The most interesting things to configure are on the process page.

First of all, make sure to not select the LightSwitch solution to build but the lightswitch project !



DO NOT specify here a configuration to build. Don’t try it, because if you do so, your build will fail. In the end, we want to build the release configuration, but we’ll see in the next step how to specify this.



So, the MsBuild arguments are specified as follows: /p:Configuration=Release /t:Publish. Note that we specify here that we want a release build. Also the Publish task is triggered here.

Multi-Proc is disabled. This prevents parallel builds and we specify we want to build on the x86 platform.

The Result
build result

In the drop location you can find the web deploy package:





So far, apart from the fact it works, nothing special.

It will become more interesting in the next steps, where we also deploy the website, etc. …