So you want to deploy your web app and web job(s) together in Azure? Are you looking for the upgrade of my earlier post? This post is here to make it easier for you. It works for Visual Studio Team Services (VSTS).
Step 1: Restore NuGet packages
For this step, use a simple command line task.
Step 2: Build all the projects
For this step use a Visual Studio build task. You only need to set the BuildConfiguration to x86 or x64 or Any Cpu or to the environment variable $(BuildConfiguration) since the rest are normally already set before you do it.
Step 3: Build and publish the webApp
Use a simple command line task. Assuming that the web app is named MyWebApp, set the following fields:
publish -c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory)\webApp
Step 4: Build and publish the webJob
Use a simple command line task. Assuming that the web job is named MyWebJob, set the following fields:
publish -c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory)\webApp\App_Data\jobs\continuous\webJob
Step 5: Zip the artifacts
When using VSTS release definitions, it is normally easy to use a Website deployment task which normally takes a zip file. Therefore, we need to zip the artifacts. Note, after Step 4 the output, has the right structure for housing the web app and the web job in azure.
This task is not provided by default in VSTS, we use the Trackyon Advantage extension which you can install into your account. Set the provided fields to:
Folder to zip:
Path to final Zip file:
Step 6: Upload the artifacts
For this step use a Copy Publish Artifact task with the following fields:
The build step should be as simple as in the image below.
This applies to the release management feature of VSTS. Once you link the build artifacts to your release definition, add an Azure Web App Deployment task. The only sensitive variable being the Web Deploy Package. I used
$(System.DefaultWorkingDirectory)\**\*.zip and it worked.