How to make ASP.NET Core RC2 app build on net46 framework with older third party dependencies

…衆ロ難τιáo~ 提交于 2019-12-06 00:46:09

Your approach is close. Well done. There are a few changes/additions to make. The following works with dotnet restore then dotnet run. The full code listing is on GitHub.

frameworks

Your frameworks fail because .NET Core (netcoreapp) is not compatible with .NET Framework (net), so you cannot import net45. Your errors say that Kendo.Mvc is compatible with dnx451 and dnxcore50; import one of those instead. Then add a portable import for some packages on which Kendo.Mvc depends (if you don't, you will see build errors that tell you to do this.)

"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dnxcore50",
      "portable-net45+win8+wp8"
    ]
  }
}

Now your app will restore and build. It won't run yet, though.

dependencies

Change your dependency on Microsoft.NETCore.App not to have the "type" : "platform". Otherwise your app will not run on its own, because NuGet will suppress the package's assets.

"dependencies" : 
{
    // others omitted for clarity
    "Microsoft.NETCore.App": "1.0.0-*",
    "Kendo.Mvc": "*"
}

runtimes

Add a runtimes section; we now specify this in project.json instead of relying on dnvm.

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