.NET Core: A Beginner Introduction
Published: 2023-11-06 19:55:38

## Motivation
I have been learning ASP.NET Core for some time now. During the process, I struggled to differentiate between .NET Core and .NET Framework. To help beginners from the struggle of understanding what .NET Core is and how it is different from .NET framework, I wrote this article.

## What is .NET Core?
.NET Core is a cross-platform (supports Windows, macOS, and Linux), [open-source](https://github.com/dotnet/coreclr/blob/master/LICENSE.TXT) and general-purpose application development platform. The platform is being maintained by Microsoft and the [.NET community in GitHub](https://github.com/dotnet/core). According to the [MSDN](https://devblogs.microsoft.com/dotnet/announcing-net-core-1-0/), it can be used to create console applications, modern web applications, microservices and libraries.

## What is .NET Framework?
.NET Framework is a platform for building apps for web, Windows, Windows Phone, Windows Server, and Microsoft Azure. It is developed by Microsoft and primarily runs on Microsoft Windows. The components of .NET framework include the common language runtime (CLR) and the .NET class library.

## The Architectural Components of .NET Core
One of the key characteristics of .NET core is modularization. This means that it is made up of a set of modular components. The main components of .NET Core are:

### 1. .NET Core Runtime
This is a software environment that provides services such as security, memory management, and exception handling for .NET Core applications. It is responsible for loading and executing .NET assemblies, which are the compiled output of .NET core programs.

### 2. Collection of SDK tools and compilers
This collection of tools and compilers enables developers to create, build, run, and test .NET Core applications. It includes a command-line interface (CLI) for the .NET Core SDK, as well as compilers for C# and Visual Basic.

### 3. Collection of Framework libraries
Framework libraries provide the fundamental building blocks for developing .NET applications. They include primitive data types, utility classes, and other essential functionality.

## Getting Started with .NET Core
.NET core is distributed in two different ways to accommodate different use cases and deployment scenarios:

### NuGet Package:
.NET Core can be distributed as a [NuGet package](https://learn.microsoft.com/en-us/nuget/#:~:text=NuGet%20is%20the%20package%20manager,these%20libraries%20as%20%22packages%22.). NuGet is a package manager for .NET that allows developers to easily download and manage libraries and frameworks. When .NET Core is distributed as a NuGet package, it means that you can include it as a dependency in your project just like any other library. This method is often used when you want to build and develop applications that target .NET Core. You can specify the version of .NET Core you want to use in your project, and the NuGet package manager will handle downloading and managing the appropriate version of .NET Core for your application.

#### Downloading and Installing .NET via NuGet Package (as of .NET 5 or later)
If you're using [Visual Studio](https://visualstudio.microsoft.com/downloads/), make sure it is installed and updated to the latest version. If you're not using Visual Studio, you can still download .NET SDK using the command line as shown in the following steps:
- Open a Terminal (Linux/ MacOS) or Command Prompt (Windows)
- Check for Existing .NET SDK using the below command. If you see a version number, that means the .NET SDK is already installed. If not, you'll need to download it.
              `dotnet --version`

- Download and Install the .NET SDK. To do this first check the list of .NET SDKs that are available for download using:
            `dotnet --list-sdks`

- Choose the version that you want to install and install it using:
            `dotnet install --version 6.0`

Finally, verify the installation using: 
              `dotnet --version`

### Standalone distribution
This means that you can download a complete and self-contained installation of .NET Core, separate from any specific project or application. This standalone distribution includes the runtime, libraries, and development tools. Standalone distributions are often used in scenarios where you need to run or host .NET Core applications without integrating .NET Core into a specific project. For example, you might install a standalone distribution of .NET Core on a server to run multiple .NET Core applications independently. To install the .NET Core standalone distribution on Windows, Linux, and macOS, follow these steps:

#### Windows
1. Download the .NET Core standalone distribution from the Microsoft website: https://www.microsoft.com/net/download.
2. Double-click on the downloaded file to start the installation process.
3. Follow the prompts on the screen to complete the installation.

#### Linux
1. Open a terminal window.
2. Download the .NET Core standalone distribution from the Microsoft website: https://www.microsoft.com/net/download.
3. Extract the contents of the downloaded archive to a directory on your machine.
4. Open a terminal window and navigate to the directory where you extracted the .NET Core standalone distribution.
5. Run the following command to install the .NET Core standalone distribution:
`./dotnet-install.sh`

6. Enter your password when prompted.

#### MacOS
1. Open a terminal window.
2. Download the .NET Core standalone distribution from the Microsoft website: https://www.microsoft.com/net/download.
3. Extract the contents of the downloaded archive to a directory on your machine.
4. Open a terminal window and navigate to the directory where you extracted the .NET Core standalone distribution.
5. Run the following command to install the .NET Core standalone distribution:
            `./dotnet-install.ps1`

6. Enter your password when prompted.

Once the installation is complete, you can verify that the .NET Core standalone distribution is installed correctly by running the following command:
                     `dotnet --version`

## Differences between .NET Framework and .NET Core Framework
The key differences between .NET framework and .NET Core are:
1. Open-source-The entire .NET Core Framework is made open-source (using MIT and APache 2 licenses) while only a portion of .NET Framework is open-source such as the Entity Framework.
2. Cross-platform- Unlike .NET Framework which only runs on Windows operating system, .NET Core runs on Windows, macOS and Linux operating systems.
3. Components/ Subsystems- Certain aspects of the .NET Framework, like code access security, are not available in .NET Core because of its more streamlined programming model.
4. API Support- Not all APIs available in .NET Framework are supported by .NET Core.


















## References
1.	https://www.c-sharpcorner.com/article/an-introduction-to-net-core/
2.	https://medium.com/net-core/introduction-to-net-core-adbf1962d57d
3.	https://devblogs.microsoft.com/dotnet/announcing-net-core-1-0/
4.	https://learn.microsoft.com/en-us/dotnet/core/introduction