Installing and Setting Up MVC
Building ASP.NET MVC applications requires Visual Studio (Community edition is free) with the 'ASP.NET and web development' workload installed, or, for the modern ASP.NET Core MVC flavor, the .NET SDK plus any editor (Visual Studio, VS Code with the C# extension, or Rider). Classic ASP.NET MVC targets .NET Framework and runs on Windows/IIS, while ASP.NET Core MVC is cross-platform and runs on Windows, macOS, and Linux via Kestrel.
Cricket analogy: Choosing classic MVC (Windows-only) versus ASP.NET Core (cross-platform) is like choosing between a domestic-only cricket league that only plays on home turf versus an international circuit that tours grounds worldwide.
Creating a New Project
In Visual Studio, File > New Project > ASP.NET Web Application (.NET Framework) lets you pick the 'MVC' template, which scaffolds the full folder structure (Controllers, Views, Models, App_Start) along with NuGet references to Microsoft.AspNet.Mvc, System.Web.Mvc, and Entity Framework. For ASP.NET Core MVC, the equivalent is running dotnet new mvc -n MyApp from the CLI, which generates a leaner Program.cs-based startup instead of Global.asax.
Cricket analogy: dotnet new mvc -n MyStoreApp scaffolding a full project structure is like a franchise league instantly setting up a new team's kit, ground, and roster template the moment it's registered.
Configuring NuGet Packages and Dependencies
Classic MVC projects rely on NuGet for core dependencies like Microsoft.AspNet.Mvc, Microsoft.AspNet.Razor, and EntityFramework, all restorable via right-click 'Manage NuGet Packages' or the Package Manager Console command Update-Package -reinstall. ASP.NET Core MVC instead lists its dependencies as PackageReference entries in the .csproj file, and running dotnet restore pulls everything needed before the first build.
Cricket analogy: NuGet restoring Microsoft.AspNet.Mvc dependencies is like a cricket board ensuring every required piece of equipment (bats, pads, helmets) is delivered to a new team before their first match.
dotnet new mvc -n MyStoreApp
cd MyStoreApp
dotnet restore
dotnet runRunning and Debugging the Application
Pressing F5 in Visual Studio launches IIS Express, compiles the project, opens a browser at a localhost port (e.g., https://localhost:44300), and attaches the debugger so breakpoints in controller actions or Razor views work immediately. For ASP.NET Core, dotnet run starts the Kestrel web server directly, and launchSettings.json under /Properties controls which profile (IIS Express, project, or a specific URL/port) is used when debugging.
Cricket analogy: Setting breakpoints in a controller action during F5 debugging is like a coach pausing match footage frame-by-frame at a specific delivery to analyze exactly what happened.
If a fresh project fails to build immediately after scaffolding, the most common cause is a missing or mismatched NuGet package restore - right-click the solution and choose 'Restore NuGet Packages,' or run dotnet restore from the project directory.
Classic ASP.NET MVC (targeting .NET Framework) only runs on Windows via IIS or IIS Express. If you need cross-platform support (Linux/macOS deployment, Docker), you must use ASP.NET Core MVC instead, which is a different (though conceptually similar) framework.
- Classic ASP.NET MVC needs Visual Studio with the 'ASP.NET and web development' workload, and runs only on Windows/IIS.
- ASP.NET Core MVC is cross-platform, using the .NET SDK and Kestrel, installable on any OS.
- File > New Project > MVC scaffolds Controllers/Views/Models automatically in Visual Studio.
- dotnet new mvc -n MyApp is the CLI equivalent for ASP.NET Core projects.
- Classic MVC dependencies come via NuGet; ASP.NET Core lists them as PackageReference in .csproj.
- F5 in Visual Studio launches IIS Express with an attached debugger.
- dotnet run starts Kestrel directly for ASP.NET Core projects, configured via launchSettings.json.
Practice what you learned
1. What Visual Studio workload is required for classic ASP.NET MVC development?
2. What CLI command scaffolds a new ASP.NET Core MVC project?
3. Where does ASP.NET Core MVC list its package dependencies?
4. What web server does dotnet run start for ASP.NET Core MVC?
5. Which statement about classic ASP.NET MVC's platform support is correct?
Was this page helpful?
You May Also Like
What Is ASP.NET MVC?
An introduction to ASP.NET MVC, Microsoft's web framework built on the Model-View-Controller pattern for building dynamic, testable web applications on .NET.
Project Structure in ASP.NET MVC
How a typical ASP.NET MVC project is organized on disk - the Models, Views, and Controllers folders, App_Start configuration, and supporting conventions.
MVC vs Web Forms
A comparison of ASP.NET MVC and ASP.NET Web Forms - architecture, state management, testability, and when you'd still encounter Web Forms today.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows 10 / UWP Development Study Notes
.NET · 30 topics
Microsoft TechnologiesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesWPF (Windows Presentation Foundation) Study Notes
.NET · 30 topics