Building Part 3: Creating a Build Definition

In this blog I will describe the steps you need to take in order to setup a build definition in VSTS that will run on the Build Agent installed in Part 1 and 2 on a Build Server.

All you need here is a browser.

Login to your VSTS Team Project and click on Build and Releases.

Now click on “New” to create a new build definition.

Make sure to select the correct sources to be used for building your app.

Click on Continue and select “Empty process”

Now you can start editing your build definition.

The first thing to get done is adding a PowerShell script to “Phase 1”

You do this by clicking the “+” sign

Search for “powershell” and add a PowerShell task

Click on the new PowerShell tasks on your left and populate the task as seen in this screen shoot.

You are now almost done.

We just need to publish the Artifacts from the build definition which can be done the following way.

Add a new task to Phase 1 called “Publish Build Artifact” the same way we added the PowerShell task and populate it with the following parameters.

Now we are missing one more thing and that is to decide what triggers a build.

Personally I prefer Continuous Integration which means as soon as a developer commits any code into the branch selected for this build it will trigger a fresh build of the application.

You can set that up by clicking on “Triggers” and “Enable continuous Integration”

Save your build definition.

You are now done. Every time anyone does a commit to the git repository in VSTS a new build will happen.

Here is a screen shot of the first build for this scrip while it was running.

and after a successful build you can download your app from the Artifact tab under the build

The life as a developer just got a lot easier.

Have fun setting up your own Build Server.

A special thanks to Mike Glue for sharing his great knowledge with me.

Comment List