5

In my solution i have an aspnet core 2.2 WebApp, and i want to add an existent project like webJob but there isn't the option: Add WebJobs from existent project

enter image description here

Why? With the same procedure i add WebJobs on my other .Net application, and this option is shown in visual studio 2019

EDIT

Changed images with english language. Sometimes the Add > Existing project as Azure WebJobs it's showned but if I click on it it shows this error:

enter image description here

(the selected project is the aspnet.core 2.2. WebApp)

After this click , the Add > Existing project as Azure WebJobs is no longer visible.

C1X
  • 665
  • 4
  • 14
  • 25
  • Please share the visual studio screenshot with English language. – Rena May 20 '20 at 08:41
  • @Rena shared and edited – C1X May 20 '20 at 10:06
  • Already have a feedback here: https://developercommunity.visualstudio.com/content/problem/806009/existing-project-as-azure-webjob-results-in-generi.html you can vote it. Or maybe you can try not to use this feature and choose to deploy the web job after the web app is deployed. – Cindy Pau May 20 '20 at 10:38

1 Answers1

4

Update:

For example, if you want to deploy a console app as webjob manually.

  1. Create a Console app. Below is my code:

    using System;

    namespace testwebjob { class Program { static void Main(string[] args) { Console.WriteLine("This is my first webjob!"); } } }

2.Build the console app, then right click and choose this:

enter image description here

3.Go to bin -> Debug -> xxx, then you will find a folder with below files,add a run.cmd and zip them.

enter image description here

This is the content of my run.cmd:

@echo off

dotnet testwebjob.dll

enter image description here

4.Go to azure web app, search webjob. Click add and upload the zip file.

enter image description here

enter image description here

5.Then the web job has be deployed. This is the log:

enter image description here

Original Answer:

From the documentation, you will find that 'Enable automatic WebJobs deployment with a web project' is a feature supported by .net framework web app. It seems .net core web app is not supported.

In fact there is already a feedback about this. You can vote here:

https://developercommunity.visualstudio.com/content/problem/806009/existing-project-as-azure-webjob-results-in-generi.html

Maybe you can try not to use this feature and choose to deploy the web job after the web app is deployed.:)

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • But how can i deploy a webjob manually? I tried by uploading a zip file in Azure but it shows generic error – C1X May 20 '20 at 14:06
  • @C1X I have update the answer. You can follow my steps, it works. I think there is no cmd file in your compressed package. What is the detail of your error? – Cindy Pau May 20 '20 at 14:54
  • Thank you! This solve my first problem , the manually deploy. But now there is another problem..... -> https://stackoverflow.com/questions/61923589/azure-webjob-error-an-assembly-specified-in-the-application-dependencies-mani – C1X May 20 '20 at 21:54