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

asp.net-core dotnet-cli entity-framework-6 kendo-asp.net-mvc wcf

Question

I have a brand-new Asp.Net Core MVC application that uses some vintagenet45 libraries.

Works perfectly with the complete Net45 framework and Asp.Net Core RC1. I've encountered a problem while moving from Asp.NET Core rc1 to rc2 that I'm unsure how to resolve.

The app uses EF6, Autofac, and Kendo and is an ASP.NET Core application. MVC, and it must function fully. There are references to libraries that use WCF in the Net 4.6 framework.

In order to transition from RC1 to RC2, I must first change the NuGet.config feed tohttps://www.myget.org/F/aspnetcirelease/api/v3/index.json the following modifications are then made to theproject.json

  • Take "version" out of the root node.
  • To the complationOptions object, add the following attribute: The portable "debugType"
  • dependencies: alterationAspNet to AspNetCore
  • dependencies: modify eachrc1-final , to*
  • Verify thatMVC and MVC Tag Helpers have changed their names to6.0 to 1.0
  • Get rid of all ties toApplication Insights
  • Eliminate all reliance onMicrosoft.AspNet.Tooling.Razor
  • include a dependence"Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-*" }
  • Add a fresh content item:"content": [ "wwwroot", "Views", "web.config", "appsettings.json" ]
    • Update all referencing statementsAspNetCore.* in place ofAspNet.*

I then substitute: for the frameworks object

"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "net45"
    ]
  }
}

I do adotnet restore and all problems are solved except for one package:

error: Package Kendo.Mvc 2016.1.412 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Kendo.Mvc 2016.1.412 supports:
error:   - dnx451 (DNX,Version=v4.5.1)
error:   - dnxcore50 (DNXCore,Version=v5.0)
error: One or more packages are incompatible with .NETCoreApp,Version=v1.0.
info : Committing restore...


Errors in project.json
    Package Kendo.Mvc 2016.1.412 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Kendo.Mvc 2016.1.412 supports:
      - dnx451 (DNX,Version=v4.5.1)
      - dnxcore50 (DNXCore,Version=v5.0)
    One or more packages are incompatible with .NETCoreApp,Version=v1.0.

Consequently, Kendo.MVC must referencenet45 or net451 in place ofdnx451 , however I am unable to modify this because it is a NuGet feed.

Do you know if there is a temporary patch I can implement rather than waiting for the upcoming Kendo.MVC release?

1
3
5/3/2016 5:03:36 PM

Accepted Answer

You're getting close. Good work. A few adjustments/additions must be made. The subsequent functions withdotnet restore then dotnet run The 11-zzz-zzz.

frameworks

Your frameworks fail due to Core.NET (netcoreapp ) and the.NET Framework incompatible (net ), preventing you from importingnet45 Your mistakes imply thatKendo.Mvc is appropriate fordnx451 and dnxcore50 instead import one of those. Add a portable import for a few of the packages on whichKendo.Mvc dependencies (if you don't, build errors will appear telling you to do this.)

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

Your app will now rebuild and restore. But as of yet, it won't run.

dependencies

Reduce your reliance onMicrosoft.NETCore.App not possessing the "type" : "platform" Otherwise, NuGet will suppress the package's assets, preventing your app from running independently.

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

runtimes

Add a runtimes section; we've updated the project to reflect this. json rather than relying ondnvm .

"runtimes": {
  "win8-x64": {}
}
7
4/5/2018 11:06:31 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow