WebJobs in .net core 2.x

netcore2.x project does not build to exe

When adding a .net core project in visual studio as commandline project, the project file is marked to output an exe:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
  </ItemGroup>
</Project>

So when we look in the output folder and look at the build result, the project is built as dll file.

Webjobs need to be executable

The fact that the project built to a dll confused me. I assumed it was an exe and so when deploying to the right folder (app_data/jobs/continuous/{MyJobName}), the job was not showing in the Azure portal.

After some web searching I figured out I needed to a magic file to my job folder. The magic file must be named run.cmd.

In that run.cmd file you should add the following command so that your project dll will be run:

dotnet {your project name}.dll