Get started with ASP.NET Core

  1. Install the .NET Core SDK 2.0 or later.

  2. Create a new .NET Core project.

On macOS and Linux, open a terminal window. On Windows, open a command prompt. Enter the following command:

dotnet new razor -o aspnetcoreapp
  1. Run the app with the following commands:
cd aspnetcoreapp
dotnet run
  1. Browse to http://localhost:5000.

  2. Open Pages/About.cshtml and modify the page to display the message "Hello, world! The time on the server is @DateTime.Now":

@page
@model AboutModel
@{
    ViewData["Title"] = "About";
}
<h2>@ViewData["Title"]</h2>
<h3>@Model.Message</h3>

<p>Hello, world! The time on the server is @DateTime.Now</p>
  1. Browse to http://localhost:5000/About and verify the changes.

Next steps

For getting started tutorials, see ASP.NET Core Tutorials.

For an introduction to ASP.NET Core concepts and architecture, see ASP.NET Core Introduction and ASP.NET Core Fundamentals.

An ASP.NET Core app can use the .NET Core or .NET Framework Base Class Library and runtime. For more information, see Choosing between .NET Core and .NET Framework.

  1. Install the .NET Core SDK Installer for SDK 1.0.4 from the .NET Core All Downloads page.

  2. Create a folder for a new .NET Core project.

On macOS and Linux, open a terminal window. On Windows, open a command prompt.

mkdir aspnetcoreapp
cd aspnetcoreapp
  1. If you have installed a later SDK version on your machine, create a global.json file to select the 1.0.4 SDK.
{
"sdk": { "version": "1.0.4" }
}
  1. Create a new .NET Core project.
dotnet new web
  1. Restore the packages.
dotnet restore
  1. Run the app.
dotnet run

The dotnet run command builds the app first, if needed.

  1. Browse to http://localhost:5000.

Next steps

For getting started tutorials, see ASP.NET Core Tutorials.

For an introduction to ASP.NET Core concepts and architecture, see ASP.NET Core Introduction and ASP.NET Core Fundamentals.

An ASP.NET Core app can use the .NET Core or .NET Framework Base Class Library and runtime. For more information, see Choosing between .NET Core and .NET Framework.