An Introduction to Cross-Platform .NET

Posted in programming with tags csharp dotnet -


This article covers the Open Source .NET Core, and associated tools.


The .NET Core implementation itself consists of the CoreCLR, which is the runtime for .NET Core, and CoreFX, the standard libraries for .NET Core. Many other libraries and tools are shared between .NET Core and other implementations. The various implementations of .NET follow the .NET Platform Standard to ensure that they remain interoperable.

There are currently other implementations of the .NET APIs and programming languages. The .NET Framework supplied with most editions of Windows is not Open Source, although the code is available for reference purposes.

Programming Languages

The .NET platforms support multiple programming languages. In practice, the C# language is the standard for .NET development.


Microsoft support two tracks of .NET Core releases. Long-Term Support (LTS) versions of .NET Core are supported for three years, and Current versions are supported for one year.

Install .NET Core releases on systems that need to run .NET applications, and the .NET Core SDK on developer systems. The .NET Core SDK includes .NET Core and the tools for building .NET Core applications.


There are two types of build for .NET Core applications. By default, .NET Core applications compile into Framework-Dependent Deployments (FDD), which means that the application itself uses platform-independent code, but relies on there being a copy of .NET Core installed on the host system. If you choose to build a Self-Contained Deployment (SCD), then the result is an executable application that includes .NET Core. Each SCD must be built for specific operating systems.

The Tools

The key developer tool that you use for setting up .NET Core projects is the dotnet command-line utility. Both the dotnet tool and the facilities in Visual Studio use NuGet, the underlying package management system for .NET platforms, and MSBuild, the tool for managing application builds.

Use the Visual Studio Code editor, which includes support for .NET Core projects, such as debugging for C#, JavaScript, and TypeScript.

If you manage Windows systems, you may also PowerShell Core useful.

The dotnet command-line utility, the Visual Studio Code editor and PowerShell Core all enable telemetry by default.

Popular Libraries

Frequently used NuGet packages are:

  • ASP.NET - A set of libraries that provide the basic capabilities for Web applications
  • ASP.NET MVC - The MVC Web framework that is built on ASP.NET
  • Entity Framework - The default ORM (Object-Relational Mapper) for .NET applications
  • Kestrel - The default HTTP server for .NET Core
  • Nancy - A lightweight Web framework that is built on ASP.NET
  • SignalR - The default WebSockets implementation for .NET (does not support .NET Core yet)
  • - The default unit testing framework

Setup on A macOS Development Workstation

First, use the installer to set up the .NET Core SDK.

Install Node.js to run JavaScript utilities:

brew install node

Use Node.js to install TypeScript:

npm install -g typescript

Use Homebrew Cask to install Visual Studio Code:

brew cask install visual-studio-code

Once you have installed Code, add the C# extension and choose Reload to enable support for C#.

If you are going to deploy your Web applications with Docker, install Docker for Mac from the Docker Website.

Creating an Application

Create a directory and change the working directory before you run any commands:

mkdir MyApplication
cd MyApplication

Use the dotnet new command to create a skeleton application. For example, the mvc option creates an ASP.NET MVC Web application:

dotnet new mvc

Building and Running an Application

To build an application, use dotnet:

dotnet build

To run an application:

dotnet run

If the application is an ASP.NET Web application, the run command starts a Web server that hosts the application on port 5000.


ASP.NET Core applications have several different modes, known as environments. By default, Web applications run in Production mode. To specify a different environment, set a shell environment variable with the name ASPNETCORE_ENVIRONMENT:



Next article
Notes on PowerShell