Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reference an existing .NET Framework Project in an ASP.NET Core

I have an existing project with .NET framework 4 its a business logic layer

I have created .NET core app with core framework and try to add exist business layer as reference and I tried with this example : How do I reference a .NET Framework project in a .NET Core project?

I also created core app with .net framework and try to add reference its also not work

please check the below images and give me help :)

---------  .net framework 

enter image description here

------ core project 

enter image description here

enter image description here

like image 646
LittleDragon Avatar asked Jan 27 '17 11:01

LittleDragon


People also ask

Can we refer NET Framework project in .NET Core?

NET Standard/. NET Core, you need to use the . NET Framework. You can now reference .

How do I add a project reference in dotnet core?

One method of adding references to your library is by typing it directly in the project. json file. As you can see that we have added some references under the dependencies section as shown in the following code. Let us now save this file and you will see that references are added to your library now.

How do I migrate a project from .NET to .NET Core?

Move Your Project File You can migrate your old project to the Core project using the 'dotnet migrate; command, which migrates the project. json and any other files that are required by the web application. The dotnet migrate command will not change your code in any way.


2 Answers

According to the chart on this page: https://docs.microsoft.com/en-us/dotnet/articles/standard/library you need to upgrade your libraries to at least version 4.5 of the Framework.

I'm currently using version 4.6 of the Framework for my libraries and referencing them from an Asp.Net Core MVC Web Project without issue.

You may find these links helpful as well:

  • Step by step instruction by Scott Hanselman: http://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCore10WebApp.aspx

  • Explaination of Target Framework Monikers: https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/

like image 128
RonC Avatar answered Oct 27 '22 01:10

RonC


I got solution when u add the reference to .net framework core project you need to click restore packages button :)

and .net core frame work project can not add the .net framework project reference

enter image description here

like image 45
LittleDragon Avatar answered Oct 27 '22 01:10

LittleDragon