Azure WebJob create with DotNet Core targeting Net Standard fails with error

大城市里の小女人 提交于 2019-12-11 03:18:10

问题


I have a dot net core console app that I want to run as a webjob in Azure. When it tries to execute I see in the logs

Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.DotNet.InternalAbstractions', version: '1.0.0', path: 'lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll'

My project.json looks like this

{
  "buildOptions": {
    "emitEntryPoint": true,
    "copyToOutput": [ "appsettings.json", "run.cmd" ]
  },
  "dependencies": {
    "Helga.Core": "1.0.0-*",
    "Helga.UpdateParkings": "1.0.0-*",
    "Microsoft.Extensions.Configuration": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.1"
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  },
  "publishOptions": {
    "include": [
      "appsettings.json",
      "run.cmd"
    ]
  },
  "version": "1.0.0-*"
}

but in project.lock.json I see

  "Microsoft.DotNet.InternalAbstractions/1.0.0": {
    "type": "package",
    "dependencies": {
      "System.AppContext": "4.1.0",
      "System.Collections": "4.0.11",
      "System.IO": "4.1.0",
      "System.IO.FileSystem": "4.0.1",
      "System.Reflection.TypeExtensions": "4.1.0",
      "System.Runtime.Extensions": "4.1.0",
      "System.Runtime.InteropServices": "4.1.0",
      "System.Runtime.InteropServices.RuntimeInformation": "4.0.0"
    },
    "compile": {
      "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {}
    },
    "runtime": {
      "lib/netstandard1.3/Microsoft.DotNet.InternalAbstractions.dll": {}
    }
  },

Please advice.


回答1:


I had made the deployment by zipping up the bin/debug folder and apparently the build references assemblies in installed sdk's etc.

When I did a Publish of the project to the filesystem and zipped up the PublishOutput folder instead everything started working because all dependant assemblies were copied to that folder.



来源:https://stackoverflow.com/questions/39891583/azure-webjob-create-with-dotnet-core-targeting-net-standard-fails-with-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!