AspNetCore.Docs/aspnetcore/getting-started.md

2.2 KiB

title author description manager ms.author ms.custom ms.date ms.prod ms.technology ms.topic uid
Get started with ASP.NET Core rick-anderson A quick tutorial that creates and runs a simple Hello World app using ASP.NET Core. wpickett riande mvc 05/10/2018 asp.net-core aspnet get-started-article getting-started

Get started with ASP.NET Core

::: moniker range=">= aspnetcore-2.0"

  1. Install the [!INCLUDE].

  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
    
  3. Run the app with the following commands:

    cd aspnetcoreapp
    dotnet run
    
  4. Browse to http://localhost:5000.

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

    [!code-cshtml]

  6. Browse to http://localhost:5000/About and verify the changes.

[!INCLUDEnext steps] ::: moniker-end

::: moniker range="<= aspnetcore-1.1"

  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
    
  3. 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" }
    }
    
  4. Create a new .NET Core project.

    dotnet new web
    
  5. Restore the packages.

    dotnet restore
    
  6. Run the app.

    dotnet run
    

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

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

[!INCLUDEnext steps] ::: moniker-end