MSDN Documentation

Microsoft Developer Network

Getting Started with ASP.NET Core

Welcome to the Getting Started guide for ASP.NET Core. This tutorial will walk you through the fundamental steps to create your first ASP.NET Core application.

Prerequisites

Before you begin, ensure you have the following installed:

  • .NET SDK: Download and install the latest .NET SDK from the official .NET website.
  • Code Editor: Visual Studio, Visual Studio Code with the C# extension, or JetBrains Rider.

Step 1: Create a New Project

1

Open your terminal or command prompt and navigate to the directory where you want to create your project.

dotnet new webapp -o MyWebApp

This command creates a new web application project named MyWebApp in a new directory.

Step 2: Navigate to the Project Directory

2

Change your current directory to the newly created project folder:

cd MyWebApp

Step 3: Run the Application

3

Execute the following command to build and run your application:

dotnet run

The output will show you the URL where your application is running (usually https://localhost:5001 and http://localhost:5000).

Step 4: Explore the Project Structure

4

Open the MyWebApp folder in your code editor. You'll find several key files and folders:

  • Pages/: Contains Razor Pages, which are the default UI model for new ASP.NET Core web apps.
  • wwwroot/: Contains static assets like CSS, JavaScript, and images.
  • appsettings.json: Configuration file for the application.
  • Program.cs: The entry point of the application.
  • Startup.cs: Configures the application's request pipeline.

For a web app template, the default page is often Pages/Index.cshtml.

Next Steps

You've successfully created and run your first ASP.NET Core application. From here, you can explore:

Continue learning and building powerful web applications with ASP.NET Core!