.NET Standard Library VS Shared Project


#1

I’m currently in the process of creating a base project configuration / library for future in-house Xamarin (iOS/Android/UWP) and Web (ASP.NET) Projects.

My idea was to have a Standard library, under that a Xamarin Forms and a Web project, and so on.

As I’m setting this up and migrating some business code from other apps, I struggle with this concept.
First, I made the Forms project a “shared code project” instead of a library to use preprocessor directives (UWP and Mono use different implementations for XML, Color and a few more).

But now I tend to just ditch the .NET Standard library altogether, as it seems too limited.
A shared code project with preprocessor directives seems to be the much better option. Visual Studio automatically underlines classes that aren’t available in all my project types anyway so I can use the preprocessor directives when needed for my different implementations. Visual Studio allows me to use the classes that all implementations have normally - just like .NET Standard.

I understand that a shared project isn’t really a project or a library and just get’s “copied” into the other projects at build. But it doesn’t really make a difference.
.NET Standard (at least until 2.0 release) seems to be very limited in comparison and having a .NET Standard and a shared project at the same time seems a little bit too much.

Any thoughts on this?


.NET Foundation Website | Blog | Projects | Code of Conduct