Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Framework and .Net Core in same solution

I have an application targeting .NET Framework, and now I need to develop a library in .NET Core. I plan to put both projects in the same solution and add the .NET Core library as a reference in the .NET Framework project.

Can this be done? If the answer is yes, how can this be done?

like image 955
vKint Avatar asked Oct 10 '16 13:10

vKint


People also ask

Can .NET Core and .NET Framework coexist?

You can only have one version of . Net Framework side by side with any number of . Net (Core) versions.

Can I install .NET Framework and .NET Core on the same machine?

NET Core installations are completely independent from the version of . NET Framework. In fact, you can actually install multiple version of . NET Core side-by-side on the same machine (unlike .

Is .NET Core and .NET Framework the same?

Net Core does not support desktop application development and it rather focuses on the web, windows mobile, and windows store. . Net Framework is used for the development of both desktop and web applications as well as it supports windows forms and WPF applications.

Is .NET Core backwards compatible with .NET Framework?

NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework. In other words, apps and components built with previous versions will work without modification on the . NET Framework 4.5 and later versions.


1 Answers

There is an article published in April 2017 on how to support both runtimes from the same solution:

https://docs.microsoft.com/en-us/dotnet/core/porting/project-structure

It boils down to 2 methods:

  • Having both frameworks configured in the same project (e.g. *.csproj):

Replace existing projects with a multi-targeted .NET Core project.

  • Having a separate project for each framework:

Keep existing projects and create a .NET Core project.


We are actively discussing which way to go in pythonnet, since the project supports .NET Framework on Windows and Mono on Linux/OSX. Now we are adding cross-platform pythonnet support:

https://github.com/pythonnet/pythonnet/pull/518

like image 81
denfromufa Avatar answered Oct 04 '22 05:10

denfromufa