What type of Visual Studio 2017 project to choose for the open-source cross-platform library UI-agnostic C # and why?

I have an idea for a C # class library that I would like to develop and publish in open-source. I would like to make it easily accessible (with recompilation, if necessary) on as many available .Net platforms as possible (for example, full .Net, Mono, .Net Core, Xamarin, only classic .Net compatibility - however). The library will not be affected by any UI and Windows-related things like WPF.

All I need is:

  • common .Net and API types (I don't want to be surprised at the lack of something that I consider an important part of the language)
  • JSON and XML controls
  • access to the file system (possibly somewhat limited)
  • HTTPS client
  • RDBMS client at SQL level (I do not need ORM functions, although, of course, I do not mind that it is available).
  • Reflection if possible
  • Asynchronous and inline devices, if possible
  • The latest version of C # is possible

I choose between the following types of projects

  • Class Library (.NET Core)
  • Class Library (.NET standard)
  • Class Library (.NET Framework)
  • Class Library (Portable)

I heard that Portable is what it says, but now we have a Core that runs on Linux and Mac (maybe Windows Phone and Xamarin?), And I have almost no problems using EF Core, which is clearly aimed on it in my classic Windows Desktop.NET Framework Application. The classic .NET Framework code seems to be very well supported on platforms other than Windows, thanks to Mono and Xamarin..NET Standard - I have no idea what this means, I just opened this type using the window search tool "New Project" "by viewing all the options for the Class Library.

Which one to choose, why and what should I know about this?

+5
source share
1 answer
  • .NET Standard Class Library: Maximum flexibility and usability in all kinds of .NET applications / platforms (evolving since Unity is not yet covered).
  • .NET Framework Class Library: An old bit that you should also know.
  • .NET Core Class Library: Common code among .NET Core applications. It exists because the .NET Standard class library has its limitations (the profile surface is usually smaller than .NET Core applications).
  • Portable Class Library (PCL): you can avoid them now if you do not need support for legacy platforms. Use .NET Standard better in the future.

You can easily run a few experiments to assert the statements I made above.

As the publisher of the library itself, I decided to send NuGet packages containing the .NET Framework version, the standard .NET version and the PCL version, and will gradually reduce the versions of the .NET Framework and PCL in the long run. Many other libraries do the same.

I also wrote a blog post to cover more

https://blog.lextudio.com/which-class-library-project-to-go-in-visual-studio-2015-2017-a48710cf3dff

+9
source

Source: https://habr.com/ru/post/1265327/


All Articles