25

How do I create an Azure WebJob targeting .NET Core 1.1?

In Visual Studio 2017, the only option I'm seeing for Azure WebJob targets .NET Framework -- see below.

enter image description here

Under .NET Core, I don't see Azure WebJob listed.

enter image description here

Sam
  • 26,817
  • 58
  • 206
  • 383
  • 2
    Until it's supported, there's an example of a WebJob targeting netcoreapp2.0 [here](https://github.com/christopheranderson/azure-webjobs-dotnet-core-sample/). – mikebridge Oct 25 '17 at 15:03
  • 1
    and [here](https://github.com/Azure/azure-webjobs-sdk/tree/dev/sample/SampleHost). – mikebridge Oct 25 '17 at 17:03

2 Answers2

16

The VS 2017 tooling for .NET Core does not exist yet, although it is planned. It's still possible to write a Core based WebJob and deploy it manually to your Web App. But do note that the WebJob SDK (which is a whole other topic) does not yet support .NET Core (related issue here).

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • I guess the way to do this is to create a console app in .NET Core and then FTP it into a WebApp on Azure. Is this the best way to handle this? – Sam Apr 07 '17 at 03:13
  • 1
    You can also zip it up and use the Azure Portal to create the WebJob. Or use Kudu Console which is easier than FTP. – David Ebbo Apr 07 '17 at 15:07
  • 2
    If you want to deploy it via git, you can find the steps here: http://stackoverflow.com/a/42914048/1138731 – lopezbertoni Apr 07 '17 at 15:09
  • 2
    I didn't realize how much of the stuff I took for granted actually came from the WebJobs SDK. Is there any documentation or examples for doing this manually? I'm trying to create a WebJob that runs continuously and gets triggered by messages in Azure Storage Queue. The current situation is a bit frustrating because the WebJobs SDK for .NET Core is not available and looks like there's no official date for its availability. It would be greatly helpful if someone came up with an example that we can follow while the SDK is being worked on. – Sam Apr 08 '17 at 07:13
  • 1
    Not sure about specific samples. You'd to have an infinite loop that polls the queue using storage SDK and sleep a second between each poll. Might be a good topic for separate question. It wouldn't be WebJobs specific, just general queue polling code. – David Ebbo Apr 08 '17 at 14:25
  • @Sam currently you will have to do some polling for that unfortunately. – Justin Herter May 17 '17 at 22:24
  • 3
    @Sam, if you need code that gets triggered by a Queue I would look at Azure Functions. – Richard Jun 08 '17 at 07:58
  • @Sam check out the sample app at https://learn.microsoft.com/en-us/azure/app-service-web/websites-dotnet-webjobs-sdk-storage-queues-how-to#trigger, and the related articles in that series. I think what you're looking for is: public static void ProcessQueueMessage([QueueTrigger("logqueue")] string logMessage, TextWriter logger) { logger.WriteLine(logMessage); } – tbetts42 Jul 07 '17 at 12:21
  • @tbetts42 this article does not sound related to this question, which is about deploying core WebJobs. – David Ebbo Jul 07 '17 at 12:26
  • @DavidEbbo Are we able to create WebJobs in .NET Core now? I was following the GitHub issue but I'm confused because I think the WebJobs SDK and Functions SDK are merged but not sure where we're currently at. Also, is this something I can handle in Visual Studio 2017? I'd appreciate any insights you may have. Thanks. – Sam Aug 01 '17 at 22:14
  • @Sam I'm hearing that this WebJobs Core support is planned for VS 15.3 (the new iteration of 2017), which is not too far out. – David Ebbo Aug 01 '17 at 22:32
  • @DavidEbbo Thanks! – Sam Aug 01 '17 at 22:33
  • 2
    It looks like in VS 15.6 this may not be available yet. – Steve Cadwallader Mar 14 '18 at 13:31
4

This is an extremely old question, but I just want to point out that WebJobs for .NET Core is now available. However it works slightly differently in that you need to use a console app with some specific build commands rather than have an actual WebJob template.

More info/tutorials here : https://dotnetcoretutorials.com/2018/10/09/azure-webjobs-in-net-core-part-1/

MindingData
  • 11,924
  • 6
  • 49
  • 68