Compatibility between . NET Core 2.0 and . NET Framework 4.7

Asked

Viewed 246 times

5

I am creating general purpose libraries (Dlls), to reuse them in projects . Net Core 2.0 and . Net Framework 4.7. I wish to have projects. Net Core on Linux and projects . Net Framework 4.7 for Windows. A library developed with . Net Core 2.0 can be used in projects. Net Framework 4.7 normally?

1 answer

5


I think the best way for you is to develop to .NET Standard (I think I need to give an updated answer there) 2.0.

It is a specification that doesn’t let you use unique features for an CLI implementation (o . NET in general terms). So everything you can use will be available no matter where you use it.

Of course this can be a bit limiting and eventually some party prefers to use something that only works on a platform.

2.0 got interesting because it makes a lot of the . NET Apis compatible. But there’s a catch.

There are criticisms that in many cases to meet the standard an implementation is launching an exception when it calls something that that platform does not support, or still does nothing, that is, compiles, but does not work as expected. It’s not much like that, it would be good to read the documentation before using something more advanced. This didn’t happen until . NET Standard 1.6.

This can also be useful. It is possible to use some things that are not in the pattern but still be possible maintain compatibility between Core and Framework.

Target .NET Standard 2.0

Creating a library whose target is . NET Standard can use in any . NET implementation that meets the standard. Obviously generating a DLL for this pattern prevents you from using anything outside of it.

Read more about the . NET Standard. See the state of .NET Standard 2.0. What about the features of each version.

.NET Standard Library

With the advent of . NET 5 all this is different.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.