6
votes

I have a two net core console apps that I deploy to Azure as web jobs using visual studio.

<Project Sdk="Microsoft.NET.Sdk;Microsoft.NET.Sdk.Publish">

It works well, when I publish them separately.

How do I publish .net core webjobs togeter with web app?

I have tried create webproject/properties/webjob-list.json. Paths are relative to webproject/webproject.csproj:

{
  "$schema": "http://schemastore.org/schemas/json/webjobs-list.json",
  "WebJobs": [
    {
      "filePath": "../PeopleWebJob/PeopleWebJob.csproj"
    },
    {
      "filePath": "../Reminder/ReminderWebJob.csproj"
    }
  ]
}

I've also tried to install Microsoft.Web.WebJobs.Publish nuget, but it looks like this approach is not working for .NET Core.

Alternativelly,

How do I publish the webjobs using VSTS?

I've tried to dotnet publish the WebJob project and copy the output to $(Build.ArtifactStagingDirectory)/webproject.zip/App_Data/jobs/Triggered

2

2 Answers

4
votes

It is not supported for VS to deploy WebJobs along with .NET Core Apps yet.

This is a similar issue, you could refer to it. To publish the webjobs via VSTS, you could refer to this link.

Besides, you can also zip it up and use the Azure Portal to create the WebJob or use Kudu Console or FTP to do it.

3
votes

Since you copy the necessary output to webproject.zip/App_Data/jobs/Triggered (do not zip published web project during dotnet publish, then copy files and zip files through Archive Files task), you just need to publish the project through Azure App Service Deploy task.

Package or folder: {the website zip file}

Check Publish using Web Deploy option in Additional Deployment Options section