Is there a way to add and start a .Net Core 2.0 REST server inside a .Net Framework 4.5.2 (or .Net Framework 4.6.1 or .Net Standard 2.0) application?

Viewed 571

Issue

Hi, I am currently working on implementing a RESTful API in C# using ASP.net Core 2.0 in Visual Studio 2017 (running only via Kestrel, therefore no IIS).

Everything works pretty well, no issues there. The thing is that I now need to integrate and start this REST Server in another project (The REST server being only one of many functionalities that need to be executed at the same time, using a "bootstrap"). My issue here is that the latter project targets .Net Framework 4.5.2 whereas the REST server targets .Net Core 2.0. Thus, when I add the REST server to the references of my bootstrap application, I encounter a couple of errors saying that some of the Nuget packages target the wrong framework.

Solutions I tried

I searched over Google but most of the issues I found were people trying to do the other way round, i.e. adding a .Net Framework-targeted project in a .Net Core application.

The way I understood this .Net implementation support table, is that a .Net standard 2.0 project can support a .Net Core 2.0 project (I am probably wrong). I tried a couple of things to make it work (which, spoiler alert, obviously and unfortunately did not work as I wouldn't be asking your help) :

  • Made the boostrap application target .Net Standard 2.0
  • Made the boostrap application target .Net Framework 4.6.1
  • Made the REST server application target .Net Standard 2.0 (which it of course didn't work, but I was kind of desperate..)

I made these target change by modifying the .csproj files.

I don't have the exact error codes because I reverted my changes a while back but they all were about projects not targeting the same framework.

So, in a tl;dr manner, what I am asking is :

Is there a way to add a .net Core 2.0 REST server inside a .Net Framework 4.5.2 (or 4.6.1 and higher/ or .Net Standard 2.0) project to start the server inside the application ?

Apologies for any english mistake as it is not my native language.

Don't hesitate to ask more info on my problem if I wasn't clear enough and thanks for the help !

0 Answers
Related