Beginner 35 min.NET 10

Your first ASP.NET Core application

Set up your tools, run an MVC application, and understand the project you just created.

BY THE END OF THIS TUTORIAL

Here's what you'll be able to do.

  • Set up Visual Studio or VS Code for .NET 10
  • Run and debug the TaskBoard companion application
  • Recognize the responsibilities of each project folder
Before you begin

Basic familiarity with files and a terminal. Install the .NET 10 SDK; a runtime alone cannot build projects.

Understand the idea

An ASP.NET Core application is a running .NET process that receives HTTP requests and produces responses. MVC gives that process a useful structure: controllers coordinate work, models describe data, and views turn data into HTML. Your editor helps you write and debug the code, but the SDK is what actually builds it.

In this curriculum you will explore TaskBoard, a deliberately small application with real accounts and a persistent database. You can run the finished application from the first lesson, then work through each feature with the relevant source beside you. This avoids the frustrating gap between an isolated snippet and a project that actually compiles.

Choose your environment

Open TaskBoard.csproj from the example download. Install the ASP.NET and web development workload and a Visual Studio release supporting .NET 10. Select the TaskBoard launch profile and press F5. Use Solution Explorer to find the files named below.

Download the complete companion project
STEP 01

Verify your development tools

In Visual Studio Installer, select the ASP.NET and web development workload and use a release that supports .NET 10. In VS Code, install C# Dev Kit and open the folder containing the project file. Both environments use the same SDK and source.

Open a terminal and check the installed SDKs. You should see a 10.0.x entry. If you only see older SDKs, install .NET 10 before proceeding. Restart your editor after installation so it picks up changes to PATH.

Terminal
dotnet --list-sdks
dotnet --info

A project targeting net10.0 needs a compatible SDK. Changing the target framework just to silence an SDK error can introduce new package compatibility problems.

STEP 02

Run the companion project

Download and extract TaskBoard from the example projects page. Enter the TaskBoard directory, restore packages, and run it. The launch profile selects Development and listens at http://localhost:5300. The first development startup applies the included migrations and creates a local SQLite file.

Open the printed address in your browser. Register a learning account, then create your first task. Stop the application with Ctrl+C, run it again, and sign back in. Your task survives because it is stored in the database, rather than in a JavaScript array.

Terminal
cd TaskBoard
dotnet restore
dotnet run
STEP 03

Read the project map

The project file selects the framework and NuGet dependencies. Program.cs registers services and builds the HTTP pipeline. Controllers handle requests; Views contains Razor templates; Models contains entities and input models. Data holds the database context and migrations. Static CSS lives under wwwroot.

Open Controllers/HomeController.cs. Index returns View(), so MVC looks for Views/Home/Index.cshtml. That file uses the shared layout for navigation and styling. Change the heading in the view, save it, and rerun to see a change you own.

Controllers/HomeController.cs
using Microsoft.AspNetCore.Mvc;

namespace TaskBoard.Controllers;

public class HomeController : Controller
{
    public IActionResult Index() => View();
    [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
    public IActionResult Error() => View("Error", HttpContext.TraceIdentifier);
}
STEP 04

Create a clean MVC project yourself

The downloaded project contains several completed features. To see the baseline separately, create a fresh project in another directory with the MVC template. Use a different port so the two applications do not compete for the same address.

Place a breakpoint inside HomeController.Index. In Visual Studio press F5. In VS Code open Run and Debug and choose the C# project; let C# Dev Kit create or select the launch configuration. Visit the homepage and inspect the HttpContext.Request.Path value when execution stops.

Terminal
dotnet new mvc -n FirstMvc -f net10.0
cd FirstMvc
dotnet run -- --urls http://localhost:5301
YOUR TURN

Make it your own.

Change the TaskBoard homepage heading and add a short sentence describing the app you want to build. Stop and restart the app, then verify both changes are visible.

See the solution & reasoning

Edit Views/Home/Index.cshtml, not the controller: the controller chooses the view, while the view owns its presentation. Rebuild with dotnet build if the change is not visible. A breakpoint in Index confirms that the request reaches the expected application.

When something doesn't work

“Address already in use” means another process owns the port. Stop that application or choose a different port.

“SDK not found” or NETSDK1045 means the selected SDK cannot target .NET 10. Inspect dotnet --info and check whether a parent global.json pins an older SDK.

A SQLite “no such table” error usually means you launched outside the Development profile or skipped migrations. Run dotnet tool restore and dotnet ef database update from the sample project directory.

CHECK YOUR UNDERSTANDING

Which component builds your C# project?

Which component builds your C# project?

ONE STEP FURTHER

That's another skill in your toolkit.

Your progress is saved in this browser. Sign in to save completion to your account.