BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Reviewing Key Concepts in .Net Core and .Net Standard

Reviewing Key Concepts in .Net Core and .Net Standard

Bookmarks

Choosing compilation targets was a relatively straightforward operation prior to .Net Core. Developers now face several possibilities and choosing a target is not so obvious anymore. To understand the big picture in .Net Core, the key concepts are: target framework monikers and .Net Standard.

Target Framework Monikers (TFM)
The Target Framework Monikers are IDs of the type framework+version that applications target in .NET Core. Monikers can be viewed as two distinct groups: the cross-platform targets, .Net Standard, and the platform implementations such as .Net 4.6, .Net Core 1.0 and Xamarin.

.Net Standard
The .Net Standard Library is at the center of portability in .Net Core. Its purpose is to define standard sets of APIs. These APIs, such as collections, threading and reflection, are implemented by platforms such as .Net Core, .Net 4.5, Xamarin and Mono. They are the basic building blocks developers use to create their own libraries and applications.

Each version of .Net Standard, from 1.0 to 2.0, defines a specific set of librairies. The following is a visual analogy of how the standard library and platforms relate to each other:

interface INetStandard10
{
    void Primitives();
    void Reflection();
    void Tasks();
    void Collections();
    void Linq();
}

interface INetStandard11 : INetStandard10
{
    void ConcurrentCollections();
    void InteropServices();
}

interface INetFramework45 : INetStandard11
{
    // Platform specific APIs
    void AppDomain();
    void Xml();
    void Drawing();
    void SystemWeb();
    void WPF();
    void WindowsForms();
    void WCF();
}

The list of all APIs and their associated netstandard version is available in the CoreFx GitHub repository.

Frameworks/Runtime Monikers
Monikers other than netstandard are actual runtimes where an application can run. The most common monikers for new applications include:

  • .NET Core - netcoreapp
  • .NET Framework - net
  • Universal Windows Platform - uap
  • Xamarin IOs - xamarinios
  • Mono Android - monoandroid

As a brief guideline for choosing a target:

App Developers: You target the platform TFM you’re writing for (netcoreapp1.0, uap10.0 , net452 , xamarinios , etc.).
Package/Library Authors: Target the lowest netstandard version you can. You will run on all platforms that support that netstandard version or higher

.Net Core vs netcoreapp1.0
.Net Core and netcoreapp1.0 have, despite the appearances, completely different meanings. The .Net Core designation, without a version number, is commonly used to describe of the whole initiative to make .Net modular and solve binary compatibility issues between multiple platforms. netcoreapp1.0, on the other hand, has a much more specific meaning. It is the moniker of the cross-platform runtime which can run on Windows, Mac OS and Linux. Put simply, .Net Core can either mean the whole cross-platform initiative or the cross-platform runtime, depending on the context.

A concrete application of this is the question of migration from Asp.Net to Asp.Net Core, where concerns were raised about dependencies not supporting .Net Core. The migration is possible if the intent is to target only the .Net Framework.This enables, for example, to use Asp.Net Core while still targeting .Net 4.6.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Thanks

    by Jeff Michelson,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Clear as mud.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT