2 minute read

This post is the second one in a series of three posts and will help you by creating a CI build for a Azure Function.

Prerequisites

This blog post is totally written using the Azure Function Visual Studio template. Information and the Azure Function tools download are listed below:

Source Control

The solution created in the previous steps needs to be added and committed to Source Control. When it is added open Visual Studio Team Services in the browser and navigate to the build tab.

 

image_thumb60

 

 

When you do not have build within your project VSTS will show a large button to add a new build definition. Click this button (“New Definition” ) or use the smaller button within the top bar.

image_thumb68

Next up is the template selection for the build definition. Select the Visual Studio Template.

image_thumb77

This will create a Build definition with some default build steps. Save the the template as your build definition by clicking on “Save & Queue”

 

image_thumb93

 

A queue build window will open with the default settings. Keep these settings to create a release build for every CPU type.

image_thumb85

You will notice that this build will fail. This is because the “.funproj” is not known by the build agent (mainly because the template is still in preview). You can notice this by the following error.

MSFTPlayground Function\MSFT.Function\MSFT.Function.funproj(8,3): Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AzureFunctions\Microsoft.AzureFunctions.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

The “.funproj” itself does not need to be build so to make the Build server run correctly we can and will exclude the project from the build. In order to get this done perform the following steps.

  1. Open Visual Studio and right click the solution.
  2. In the menu click on “Configuration Manager”
  3. Deselect the build checkbox for your Functions project. Do this for the debug and release configuration.

image_thumb167

 

When the Function project is exclude from the build Commit the sources and queue the build again and you will see that this build will run successful.

Next post will be on: Deploying the Azure Function from the Build within VSTS.