Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to publish .net core WebJob together with asp.net core web app?

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

like image 791
Liero Avatar asked May 22 '18 07:05

Liero


People also ask

How do I deploy a WebJob in app services?

Deploy to Azure App ServiceIn Solution Explorer, right-click the project and select Publish. In the Publish dialog box, select Azure for Target, and then select Next. Select Azure WebJobs for Specific target, and then select Next. Above App Service instances select the plus (+) button to Create a new Azure WebJob.


2 Answers

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.

like image 157
Joy Wang Avatar answered Oct 11 '22 08:10

Joy Wang


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

like image 3
starian chen-MSFT Avatar answered Oct 11 '22 07:10

starian chen-MSFT