6

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

Liero
  • 25,216
  • 29
  • 151
  • 297

2 Answers2

4

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.

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
3

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

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • You said: "Since you copy the necessary output to webproject.zip/App_Data/jobs/Triggered". Is there any other option? This copying is a little bit unpractical, because I have to configure with project goes to Triggered and which to Continuous folder in App_Data/jobs and it means editing build definition each time there is new or renamed WebJob, – Liero May 23 '18 at 07:30
  • @Liero You can do it programmatically (e.g. PowerShell), then run the script during VSTS build. Can't find the way to publish the .net core web jobs directly. – starian chen-MSFT May 23 '18 at 08:08