Missing dotnet.exe in Azure WebJob
The issue is that your run.cmd
uses UTF-8 with BOM (byte order marks), which in some cases causes the script engine to misbehave. The fix is to not have the BOM.
There is a mention of this on the wiki (https://github.com/projectkudu/kudu/wiki/Web-Jobs), but granted it's easy to miss.
In my experience the simplest way to get a .NET Core Console App running within the context of an Azure WebJob is to create a self-contained .exe
.
You can do this with the following command:
dotnet publish -r win10-x64 -c Release
Note that the above command produces a different output than a
Right-click > Publish
action.
This will create a folder called win10-x64
within the bin\Release\netcoreapp2.0
directory of your console app. Inside of the win10-x64
directory is another directory called publish
.
Simply compress the
...bin\Release\netcoreapp2.0\win10-x64\publish
folder and upload as a new WebJob.
The trigger mechanism will detect the .exe
and run the code within the console app.