Error loading hostpolicy.dll while deploying .NET Core console app to Azure WebJobs

Alright, I've figured it out.

If you want to deploy a dotnet core app to Azure Web Service, include the runtime "win7-x86" if you are running your app in 32-Bit platform mode.

For a Visual Studio 2015 solution, your project.json should include :

  "runtimes": {
    "win10-x64": {},
    "win7-x86": {} //IMPORTANT FOR AZURE DEPLOY
  },

Or if you have already migrated to Visual Studio 2017, your .csproj should include this in PropertyGroup:

<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>

Also, your publish profile should include the same thing:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishProtocol>FileSystem</PublishProtocol>
    <Configuration>Release</Configuration>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PublishDir>bin\Release\PublishOutput</PublishDir>
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier> // IMPORTANT
  </PropertyGroup>
</Project>

I stopped seeing this error when I changed the contents of run.cmd from

dotnet MyWorker.dll

to

MyWorker.exe