Create your first MVC app in Visual Studio 2026
The easiest way to start is Visual Studio 2026 on Windows. This lesson walks through installing it, creating an ASP.NET Core MVC project click by click, running it, and adding your own controller and view, so you finish with a working app. There is also a command-line route for macOS and Linux.
- StartInstall Visual Studio 2026Community edition is free. Tick the ASP.NET and web development workload
- Step 2Create a new projectChoose the ASP.NET Core Web App (Model-View-Controller) template
- Step 3Name itProject name MyFirstApp, pick a folder, click Next
- Step 4Additional informationFramework .NET 10 (LTS), Authentication None, Configure for HTTPS ticked, then Create
- Step 5Run itPress Ctrl+F5. Trust the development certificate the first time
- Step 6The Home page opensYour app is running in the browser
- EndAdd your own codeRight-click Controllers, Add, Controller, and start building
Step 1: install Visual Studio 2026
Download Visual Studio 2026 from the official Visual Studio website. The Community edition is free for students, open-source work and small teams. When the Visual Studio Installer asks which workloads you want, tick ASP.NET and web development. That one workload installs the .NET SDK, the project templates and everything else this course needs.
Already installed Visual Studio without it? Open the Visual Studio Installer from the Start menu, click Modify, tick the workload and click Modify again.
Step 2: create the project
Every screen below is part of the Create a new project wizard.
- On the start window click Create a new project (or use File, New, Project).
- Type MVC in the search box and choose ASP.NET Core Web App (Model-View-Controller). Check that it says C#, then click Next.
- Enter MyFirstApp as the project name, choose a location and click Next.
- On Additional information choose .NET 10.0 (Long Term Support), set Authentication type to None, keep Configure for HTTPS ticked, and click Create.
- Visual Studio creates the project and opens it. Solution Explorer on the right shows the Controllers, Models and Views folders.
Step 3: run it
Press Ctrl+F5 (Debug, Start Without Debugging) to build and run the app. The first time, Visual Studio asks you to trust the ASP.NET Core development certificate; click Yes, then Yes again in the Windows security prompt. Your browser opens the Home page at an address like https://localhost:7123.
Press F5 instead when you want the debugger, so breakpoints stop the code. While the app is running, change a view or C# code, save, and click the Hot Reload button (the flame icon, or Alt+F10) to see the change without restarting.
Step 4: add a controller
In Solution Explorer, right-click the Controllers folder and choose Add, then Controller. Pick MVC Controller - Empty, click Add, name it HelloController.cs and click Add again. Replace the generated class with this one.
using Microsoft.AspNetCore.Mvc;
namespace MyFirstApp.Controllers;
public class HelloController : Controller
{
// GET /hello?name=Asha
public IActionResult Index(string name = "friend")
{
ViewData["Name"] = name;
return View();
}
}Step 5: add its view
Right-click anywhere inside the Index method and choose Add View. Pick Razor View - Empty, name it Index.cshtml and click Add. Visual Studio puts it in Views/Hello automatically. Run the app and browse to /hello?name=Asha.
@* Views/Hello/Index.cshtml *@
@{
ViewData["Title"] = "Hello";
}
<h1>Hello, @ViewData["Name"]!</h1>
<p>This page comes from HelloController.Index.</p>No Windows? Use the command line
Visual Studio 2026 runs on Windows. On macOS or Linux, install the .NET SDK and use Visual Studio Code with the C# Dev Kit extension. These commands create and run the same project.
dotnet new mvc -o MyFirstApp
cd MyFirstApp
dotnet dev-certs https --trust
dotnet watchCommon mistakes
- The MVC template is missing from the list: the ASP.NET and web development workload is not installed.
- Picking ASP.NET Core Web App (Razor Pages) or ASP.NET Web Application (.NET Framework) by accident. Look for Model-View-Controller and make sure it is not the .NET Framework template.
- Clicking No on the certificate prompt, then seeing a browser security warning. Run dotnet dev-certs https --trust from a terminal to fix it.
- Naming the class Hello instead of HelloController, so /hello shows a 404.
Interview question
What is the difference between F5 and Ctrl+F5 in Visual Studio?
F5 (Start Debugging) runs the app with the debugger attached, so breakpoints, stepping and watch windows work, at the cost of slightly slower startup. Ctrl+F5 (Start Without Debugging) runs the app without the debugger, which starts faster and is handy when you just want to see the site, and you can keep editing and use Hot Reload while it runs.
Want the full details? Read the official Microsoft documentation for this topic.