Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class library that can be shared between .NET Framework and .NET Core

I have a big class library written in .NET 4.0 but when I reference it in a Store App that uses .NET Core, it shows an error. And further, Microsoft just released .NET Core for the next version of .NET.

I want to know what type of project will be able to be shared by both .NET 4.6 and .NET Core? Is a class library able to do that?

It seems that the release of .NET Core specialized for Store Apps causes confusion for me.

like image 306
lostincomputer2 Avatar asked Sep 28 '22 15:09

lostincomputer2


2 Answers

If you have a PCL (Portable Class Library) that works for Metro apps, it will definitely run on the fully fledged .NET (aka, your normal ASP.NET, WF, WPF applications).

That means that you don't have to do anything, besides porting your existing library to be compatible with the PCL you choose.

like image 110
Patrick Hofman Avatar answered Oct 06 '22 18:10

Patrick Hofman


There is a new target called dotnet which you can use to target the platforms DNX, UWP and .Net 4.6. Effectively, this libraries are build against .Net Core packaged libraries instead of the libraries of the full .Net Framework.

Read more here: https://oren.codes/2015/07/29/targeting-net-core/ and related posts.

like image 36
Thomas Avatar answered Oct 06 '22 19:10

Thomas