MSDN Documentation

Microsoft Developer Network

Introduction to .NET Core

Welcome to this introductory tutorial on .NET Core. .NET Core is a free, cross-platform, open-source framework for building a wide variety of applications, including web applications, microservices, IoT apps, and mobile backends.

What is .NET Core?

.NET Core is a modular, high-performance, and extensible framework. It's the successor to the .NET Framework, rebuilt from the ground up to support modern application development paradigms. Key features include:

Key Components

.NET Core consists of several core components that enable its functionality:

Getting Started with .NET Core

To start developing with .NET Core, you'll need to install the .NET SDK. You can download it from the official .NET website.

Installation Steps (Windows Example):

  1. Visit the .NET download page.
  2. Download the latest LTS (Long Term Support) or Current version of the .NET SDK.
  3. Run the installer and follow the on-screen instructions.

Once installed, you can verify your installation by opening a terminal or command prompt and running:

dotnet --version

Your First .NET Core Application

Let's create a simple "Hello, World!" console application.

  1. Open your terminal or command prompt.
  2. Create a new directory for your project:
    mkdir HelloWorldApp
    cd HelloWorldApp
  3. Create a new console application:
    dotnet new console
    This command generates the necessary project files, including Program.cs.
  4. Open the Program.cs file in your favorite text editor. You'll see code similar to this:
    using System;
    
    namespace HelloWorldApp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  5. Build and run your application:
    dotnet run

You should see the output:

Hello World!
Note: .NET Core is now simply referred to as ".NET" starting from version 5.0. While this tutorial uses ".NET Core" for historical context, future documentation might refer to it as ".NET".

Key Differences from .NET Framework

.NET Core was designed to address limitations of the .NET Framework, particularly its Windows-only nature and monolithic design. Key improvements include:

Conclusion

.NET Core provides a powerful and flexible platform for building modern applications. Its cross-platform nature, high performance, and open-source model make it an excellent choice for developers looking to build scalable and efficient software.

Tip: Explore the ASP.NET Core documentation for building web applications and APIs, or delve into Entity Framework Core for robust data access.

For more in-depth information, please refer to the official .NET documentation.