“Could not load file or assembly” error when net462 app references a netstandard1.5 library. But why?

陌路散爱 提交于 2019-12-06 13:58:26

I'm not quite sure about why this is happening, but using netstandard1.4 as a TFM for your library project would resolve your issue. In other words, project.json of your library should look like that:

{
  "buildOptions": {
    "allowUnsafe": true
  },
  "dependencies": {
  },
  "frameworks": {
    "netstandard1.4": { // <-- replace "netstandard1.5" with "netstandard1.4" or lower
      "dependencies": {
        "NETStandard.Library": "1.6.0"
      }
    }
  },
  "version": "1.0.0-*"
}

And as a current general rule of thumb: avoid using netstandard1.5 and netstandard1.6: use netstandard1.4 and lower according to your requirements until you are explicitly forced to. Wait for release of netstandard2.0. You may read the details about it in the MSDN blog artible about .NET Standard. And here's a FAQ.

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