1. Install .NET and build your first app on Windows

  2. 1

    Install .NET Core SDK

    To start creating .NET apps you just need to download the .NET Core SDK for Windows.

    Download .NET Core SDK

    This installer will install the latest stable version of the tools and put them on your PATH so you can run dotnet from the Console.

    Video: Installing .NET Core and Visual Studio Code in Windows

  3. 2

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  4. 3

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  5. Success

    You've built and run your first .NET app.

  6. Get an editor

    Visual Studio is a fully-featured integrated development environment (IDE) for developing .NET apps on Windows.

    Download Visual Studio

    Select the .NET Core cross-platform development workload during installation.

  7. Keep learning

    While you wait for Visual Studio to install, try our in-browser tutorial.

    Then, build your first .NET app using Visual Studio.

  1. Install .NET and build your first app on RHEL

  2. Red Hat provides full support for .NET Core on RHEL. We’re excited to see our partners like Red Hat follow our release so quickly. For more information head to www.RedHatLoves.NET.
  3. 1

    Enable the .NET channel for Red Hat Enterprise Linux 7 Server

    In order to install .NET from Red Hat on RHEL Server, you first need to enable the .NET channel which is available under your RHEL 7 Server subscription. You also need to ensure that your system supports enabling software collections via the scl tool.

    1. subscription-manager repos --enable=rhel-7-server-dotnet-rpms
    2. yum install scl-utils

    For help on registering your machine to get access to the channel see the Chapter 1 of the .NET Core 2.0 Getting Started Guide at Red Hat.

  4. 2

    Install and enable the .NET Core SDK

    Now you can install the .NET Core SDK and then enable the .NET software collection.

    1. yum install rh-dotnet20
    2. scl enable rh-dotnet20 bash

    For additional help and guidance on installing and enabling .NET on RHEL Server, see the .NET Core Getting Started Guide at Red Hat.

  5. 3

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  6. 4

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  7. Success

    You've built and run your first .NET app.

  8. Get an editor

    Visual Studio Code is a cross platform code editor, with support for .NET.

    Download Visual Studio Code

    You'll also need the C# extension for Visual Studio Code.

    Download the C# Extension

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on CentOS or Oracle

  2. 1

    Install .NET Core SDK

    Before you start, please remove any previous preview versions of .NET Core from your system.

    In order to install .NET Core on CentOS or Oracle Linux, first you need to get the prerequisites and then you download the .NET Core SDK binaries, extract them onto your system and put dotnet onto your PATH for the current terminal session.

    Note, a user-controlled directory must be used when installing from tar.gz on Linux systems.

    1. sudo yum install libunwind libicu
    2. curl -sSL -o dotnet.tar.gz https://aka.ms/dotnet-sdk-2.0.0-linux-x64
    3. mkdir -p ~/dotnet && tar zxf dotnet.tar.gz -C ~/dotnet
    4. export PATH=$PATH:$HOME/dotnet
  3. 2

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  4. 3

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  5. Success

    You've built and run your first .NET app.

  6. Get an editor

    Visual Studio Code is a cross platform code editor, with support for .NET.

    Download Visual Studio Code

    You'll also need the C# extension for Visual Studio Code.

    Download the C# Extension

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on Debian

  2. 1

    Install .NET Core SDK

    Before you start, please remove any previous preview versions of .NET Core from your system.

    In order to install .NET Core on Debian, first you need to get the prerequisites and then you download the .NET Core SDK binaries, extract them onto your system and put dotnet onto your PATH for the current terminal session.

    Note, a user-controlled directory must be used when installing from tar.gz on Linux systems.

    1. sudo apt-get install curl libunwind8 gettext
    2. curl -sSL -o dotnet.tar.gz https://aka.ms/dotnet-sdk-2.0.0-linux-x64
    3. mkdir -p ~/dotnet && tar zxf dotnet.tar.gz -C ~/dotnet
    4. export PATH=$PATH:$HOME/dotnet
  3. 2

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  4. 3

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  5. Success

    You've built and run your first .NET app.

  6. Get an editor

    Visual Studio Code is a cross platform code editor, with support for .NET.

    Download Visual Studio Code

    You'll also need the C# extension for Visual Studio Code.

    Download the C# Extension

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on Fedora

  2. 1

    Install .NET Core SDK

    Before you start, please remove any previous preview versions of .NET Core from your system.

    In order to install .NET Core on Fedora, first you need to get the prerequisites and then you download the .NET Core SDK binaries, extract them onto your system and put dotnet onto your PATH for the current terminal session.

    Note, a user-controlled directory must be used when installing from tar.gz on Linux systems.

    1. sudo dnf install libunwind libicu
    2. curl -sSL -o dotnet.tar.gz https://aka.ms/dotnet-sdk-2.0.0-linux-x64
    3. mkdir -p ~/dotnet && tar zxf dotnet.tar.gz -C ~/dotnet
    4. export PATH=$PATH:$HOME/dotnet
  3. 3

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  4. 4

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  5. Success

    You've built and run your first .NET app.

  6. Get an editor

    Visual Studio Code is a cross platform code editor, with support for .NET.

    Download Visual Studio Code

    You'll also need the C# extension for Visual Studio Code.

    Download the C# Extension

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on SUSE Linux Enterprise Server or openSUSE

  2. 1

    Install .NET Core SDK

    Before you start, please remove any previous preview versions of .NET Core from your system.

    In order to install .NET Core on SUSE or openSUSE, first you need to get the prerequisites and then you download the .NET Core SDK binaries, extract them onto your system and put dotnet onto your PATH for the current terminal session.

    Note, a user-controlled directory must be used when installing from tar.gz on Linux systems.

    SLES 12 SP2, openSUSE 42.2

    1. sudo zypper install libunwind libicu
    2. curl -sSL -o dotnet.tar.gz https://aka.ms/dotnet-sdk-2.0.0-linux-x64
    3. mkdir -p ~/dotnet && tar zxf dotnet.tar.gz -C ~/dotnet
    4. export PATH=$PATH:$HOME/dotnet
  3. 3

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  4. 4

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  5. Success

    You've built and run your first .NET app.

  6. Get an editor

    Visual Studio Code is a cross platform code editor, with support for .NET.

    Download Visual Studio Code

    You'll also need the C# extension for Visual Studio Code.

    Download the C# Extension

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on Ubuntu or Mint

  2. 1

    Add the dotnet apt-get feed

    In order to install .NET on Ubuntu or Linux Mint, you need to first set up the apt-get feed that hosts the package you need.

    Register the Microsoft Product key as trusted

    1. curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    2. sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

    Register the Microsoft Product feed for your distro version

    Ubuntu 14.04 / Linux Mint 17

    1. sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'

    Ubuntu 16.04 / Linux Mint 18

    1. sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'

    Ubuntu 17.04

    1. sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-zesty-prod zesty main" > /etc/apt/sources.list.d/dotnetdev.list'

    Update your package catalog

    1. sudo apt-get update
  3. 2

    Install .NET Core SDK

    Before you start, please remove any previous preview versions of .NET Core from your system.

    To install .NET Core on Ubuntu or Linux Mint, simply use apt-get.

    1. sudo apt-get install dotnet-sdk-2.0.0
  4. 3

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  5. 4

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  6. Success

    You've built and run your first .NET app.

  7. Get an editor

    Visual Studio Code is a cross platform code editor, with support for .NET.

    Download Visual Studio Code

    You'll also need the C# extension for Visual Studio Code.

    Download the C# Extension

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on macOS

  2. 1

    Install .NET Core SDK

    The best way to install .NET on macOS is to download the official installer.

    Download .NET Core SDK

    This installer will install the latest stable version of the tools and put them on your PATH so you can run dotnet from the Console.

    Note: if you have any problems with installation on macOS, please consult our release notes.

    Video: Installing .NET Core and Visual Studio Code in a Mac

  3. 2

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  4. 3

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  5. Success

    You've built and run your first .NET app.

  6. Get an editor

    Visual Studio for Mac is a fully-featured integrated development environment (IDE) for developing .NET apps on macOS.

    Download Visual Studio for Mac

    There are also third party tools for developing .NET apps. JetBrains Rider is a cross-platform .NET IDE built using IntelliJ and ReSharper technology.

  1. Install .NET and build your first app on Docker

  2. 1

    Install Docker

    Before you can try out the .NET Core Docker base images, you should install Docker.

    Refer to the macOS, Windows or Linux getting started instructions for Docker to learn more about installing Docker.

  3. 2

    Run the container using "dotnet" base image

    The following command will get you a running container with the toolchain, straight off of Microsoft's Docker Hub.

    1. docker run -it microsoft/dotnet:latest
  4. 3

    Initialize some code

    dotnet new creates a new application, console is the type of application to create, and -o hwapp sets an output directory of hwapp (short for Hello World app). cd hwapp moves into the newly created app directory.

    1. dotnet new console -o hwapp
    2. cd hwapp

    The template for console applications created a Program.cs file, with code to write "Hello World" to the console.

    Program.cs

    using System;
    
    namespace hwapp
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hello World!");
            }
        }
    }
  5. 4

    Run the app

    Finally, dotnet run will run your app.

    1. dotnet run
  6. Success

    You've built and run your first .NET app.

  7. Keep learning

    Learn more about building .NET apps with Docker.