While the Command Line Interface (CLI) is excellent for lightweight development, Visual Studio remains the flagship Integrated Development Environment (IDE) for .NET developers. It provides a robust, visual workspace filled with deep debugging tools, graphical configuration windows, and seamless project architecture management.
In this tutorial, we will walk through the professional approach to setting up an ASP.NET Core Model-View-Controller (MVC) application in Visual Studio using .NET 10. Instead of rushing into a single project setup, we will start with a clean approach by creating a Blank Solution first.
What is a Solution in .NET?
Before creating a project, it is crucial to understand a fundamental architectural concept in the .NET ecosystem: the difference between a Project and a Solution.
- A Project (
.csproj): A project is a container that compiles into a single executable file or a reusable library. It contains your actual code files, assets, and configurations (like your Controllers, Views, and Models). - A Solution (
.sln): A solution is a higher-level container or a "wrapper." It does not compile into anything itself. Instead, its sole job is to manage and tie together one or more related projects.
Why use a Solution? In real-world enterprise applications, you rarely have just one web project. You might have an MVC web project for the user interface, a separate "Class Library" project for your database logic, and another project for your automated unit tests. A Solution acts as the binder that allows Visual Studio to manage, build, and link all these separate projects together simultaneously.
Step 1: Creating a Blank Solution
To keep our architecture clean and scalable, we will create an empty solution container first.
- Launch Visual Studio.
- In the startup window, click on Create a new project.
- In the search bar at the top, type "Blank Solution".
- Select the Blank Solution template from the list and click Next.
- Configure your solution details:
- Solution name: Give it a meaningful name (e.g.,
MyBlog). - Location: Choose a folder on your hard drive where your work will be saved.
- Solution name: Give it a meaningful name (e.g.,
- Click Create.
Visual Studio will open to a completely blank screen. If you look at the Solution Explorer panel on the right side, you will see your solution listed with 0 projects inside it.
Step 2: Adding an MVC Project to the Solution
Now that our main container is ready, let's inject our Model-View-Controller web application into it.
- Right-click on your Solution name in the Solution Explorer.
- Hover over Add and select New Project...
- In the template search bar, type "MVC" or "Web App".
- Look for the template titled ASP.NET Core Web App (Model-View-Controller). Make sure it specifies C# as the language, not F# or Razor Pages. Click Next.
- Name your project (e.g.,
MyBlog.WebApp) and click Next.
Step 3: Understanding Common Project Parameters
On the Additional Information configuration screen, Visual Studio will ask you to define several foundational parameters for your application. Let's break down what these options mean:
1. Framework
This dropdown determines which runtime your application will target. Always select .NET 10.0 (Current at the time of writing this article). This ensures your application has access to the latest performance improvements, modern C# language syntax enhancements, and standard support libraries.
2. Authentication Type
This dropdown configures built-in user login logic. It offers choices like Individual Accounts (which sets up a pre-configured database for usernames and passwords).
- Our Selection: Change this setting to None.
- Why? For this configuration, we intend to construct our security architectures, middleware pipelines, and user tables manually later. Choosing "None" prevents Visual Studio from cluttering our project with default database configurations we don't currently need.
3. Configure for HTTPS
This checkbox instructs the IDE to establish local SSL certificates.
- Our Selection: Leave this Checked. It ensures your application runs securely over
https://even during local computer testing, mimicking a real production server.
4. Enable Docker
This checkbox sets up containerization scripts.
- Our Selection: Leave this Unchecked. We are focusing purely on core .NET code execution without container overhead.
5. Do not use top-level statements
By default, modern .NET creates a highly condensed Program.cs file. Checking this box would revert it to an older, boilerplate-heavy layout containing explicit Main methods. Leave it Unchecked to enjoy modern, clean C# syntax.
Click Create. Visual Studio will scaffold the MVC folders (Models, Views, Controllers) directly inside your blank solution wrapper.
Step 4: Running the Project in Visual Studio
Launching your web application inside Visual Studio is incredibly easy and provides deep debugging integration out of the box.
Look at the top toolbar in Visual Studio. You will see a green play button icon next to a dropdown menu. This dropdown menu lists your Execution Profiles.
- Select the Profile: Click the dropdown next to the green arrow. You will typically see two options:
IIS Express: Runs the application inside a classic Windows-centric web helper.Project Name(e.g.,MyBlog.WebApp): Runs the app natively using .NET's built-in cross-platform web server, Kestrel. It is highly recommended to select the native Kestrel profile.
- Launch: Click the green Play button (or press
F5on your keyboard).
What Happens Under the Hood?
Visual Studio automatically compiles your code files, checks for background build errors, launches a secure background web server instance, and automatically pops open your default desktop web browser pointing directly to your local application URL (e.g., https://localhost:7001).
To stop the web application from running, simply go back to Visual Studio and click the red square Stop Debugging button in the top toolbar (or press Shift + F5).
Summary Table
| Step Component | Key Action / Parameter | Purpose |
|---|---|---|
| Solution Wrapper | Create a Blank Solution first | Houses multiple architectural projects cleanly in one interface. |
| Framework Selector | Choose .NET 10.0 | Leverages the latest runtime speed improvements and features. |
| Authentication Type | Set to None | Starts with a lean project; allows manual security building later. |
| Launch Profile | Choose the native Kestrel profile | Runs the fast, modern, cross-platform server profile. |
Practice Questions
1. Explain why it is considered standard practice to create a Blank Solution before adding a web project in Visual Studio.
- Answer: Creating a Blank Solution establishes an organized architectural boundary. It ensures that when you need to add supporting projects later—like a testing suite or a backend data class library—they can sit neatly alongside the web project under one shared solution file, rather than being tangled inside the web project folder.
2. When configuring an ASP.NET Core web application, what occurs if you set the Authentication Type parameter option to "None"?
- Answer: Visual Studio scaffolds a clean web framework without any pre-built database structures, login screens, or membership registration code. This leaves the security layer blank so developers can install and configure their custom authentication pipelines manually.
3. What is the fundamental difference between the "IIS Express" and the "Kestrel" launch profiles in Visual Studio?
- Answer: IIS Express is an emulated, Windows-only web server environment used historically for local testing. Kestrel is .NET's modern, lightweight, high-performance, cross-platform web server that runs identically across Windows, macOS, and Linux systems.
4. True or False: If you stop debugging by clicking the red square button in Visual Studio, your website remains active and browsable in your open browser window.
- Answer: False. Stopping the debugger commands Visual Studio to safely shut down the hosting process and kill the local web server, causing any further browser page refreshes to fail with a "Site cannot be reached" error.