Building Azure webjobs in VSTS

Thomas Hellstrøm
Oct 4, 2017 · 1 min read

Creating continous deployment in VSTS for a console app to run as an Azure webjob is something I do too seldom so I always tend to forget this crucial information to build it correctly.

If you just add a console app in your solution and run msbuild like this it will not package a zip file for you:

msbuild SampleAgent.sln /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=”d:\repos\SampleAgent\bin\” /p:Configuration=Release

The crucial part is to rembember to add Microsoft.Web.WebJobs.Publish from nuget on your console app project and then you need to do a fake “publish as a webjob” so that VS creates a publish settings.json in properties for you. When you retry the MSBuild it should now create a zip that can be published as an artifact in VSTS and deployed on Azure.

VSTS build solution

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store