Sam
Sam

Reputation: 5677

Why mix .Net Standard and .Net Core projects in one solution?

I just started working through the Apress "Building Web Applications with Visual Studio 2017". I am at the beginning setting up the projects. So I set up a solution called SpyStore. Then a .Net Core console app called SpyStore.DAL. Then a .Net Standard Class Library project called SpyStore.Models.

My question is why would the author choose .Net Standard class library over .Net Core Class library. Is there a difference?

What is the difference between .Net Standard and .Net Core. And could there be a reason for him mixing Standard in all of the sudden?

Upvotes: 0

Views: 2329

Answers (1)

Treziac
Treziac

Reputation: 3264

You can visualize .netstandard as a set of APIs. It is implemented by multiple runtimes, like netframework (net461, net47 monikers for example) or netcore (netcoreapp) A lib is not an executable, so it is independent from the concrete implementation.

Because you may want to use your library in a .net framework project (or any other implementation of .net standard), targeting netstandard make sure it is fully portable to any of these implementation, where a netcoreapp lib would only be targetable from a netcoreapp project.

An app can only be netcoreapp or netcore, as it is dependent of the implementation of the framework

You can find more infos here, and which platform implements which version of netstandard: https://learn.microsoft.com/dotnet/standard/net-standard

Upvotes: 5

Related Questions