Building Azure webjobs in VSTS

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\SampleAgent.zip” /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

--

--

Cloud architect, interested in security, devops, Azure PaaS, machine learning and digital products. CTO @ Talentech.com

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
Thomas Hellstrøm

Cloud architect, interested in security, devops, Azure PaaS, machine learning and digital products. CTO @ Talentech.com