How to Create ASP.NET MVC5 Web Project in Visual Studio 2022?

How to Create ASP.NET MVC5 Web Project in Visual Studio 2022?

Today we are going to quickly go over a small change that happened in Visual Studio 2022. And, that is the creation of a MVC5 Web Project.

If you did update to Visual Studio 2022, you will notice that ASP.NET Web Application (.NET Framework) is not listed under the project templates. In this short tutorial, we will see what happened and how to create ASP.NET MVC5 Web Project in Visual Studio 2022.

The Visual Studio 2022 Update

Historically, the .NET Framework has only worked on Windows devices. And Visual Studio played a big part of that. Up until now, Microsoft’s complete attention was devoted to maintaining, growing and developing the .NET Framework.

As of recently, the company has been pushing hard with its cross-platform, open source vision of software development, promoting the .NET Core and ASP.NET Core frameworks. And that vision is reflected in their latest Visual Studio 2022 update.

Once the IDE is installed, there is no more option for you to create ASP.NET MVC5 Web Project in Visual Studio 2022. So, the question still lingers. What can we do about it? How can we create a new ASP.NET MVC5 Web Project?

More DevInDeep Tutorials:

Create ASP.NET MVC5 Web Project in Visual Studio 2022: Solution

Start by running Visual Studio 2022. You should get the following window

Visual Studio 2022 Start a New Project
Visual Studio 2022 Start a New Project

This should be quite familiar, since this window is no different than its Visual Studio 2019 predecessor. Click on Create a new project option. As a result Visual Studio 2022 will open another window.

On the Create a new project page, make sure to select C# as the language of choice. Then set the platform to Windows and select Web as the project type. Visual Studio 2022 will then list the start-up project templates.

Now, try to find the following template: ASP.NET Web Application (.NET Framework). Most probably you won’t be able to. Visual Studio forces you to use the .NET Core framework for your web project by default.

You can also try and search for the template. Please feel free to start typing the name of the template, but the search will yield no familiar results.

How to Create ASP.NET MVC5 Web Project in Visual Studio 2022?
Visual Studio 2022 – Create a New Project

The Problem

If you have just installed Visual Studio 2022, chances are the ASP.NET Web Application (.NET Framework) project will not be listed in the start-up project templates. It seems like the .NET Core option is the new standard Microsoft is pushing for. So why would Microsoft do that?

Well .NET Core is a new version of .NET Framework, which is a free, open-source, general-purpose development platform maintained by Microsoft. It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems.

This brand new framework can be used to build different types of applications such as mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc. It is lightweight, fast and cross-platform. That is why Microsoft is rooting for you to use it.

As a result, the ASP.NET MVC5 Web Project template under .NET Framework was removed. You won’t be able to find it and use it, under Visual Studio 2022.

So, if you want to create MVC5 Web Solution you have to install some additional components. In this tutorial we will see how to do just that.

The Solution

Since we want to create ASP.NET MVC5 Web Project in Visual Studio 2022 we must install one very important component. To do that launch Visual Studio Installer.

Visual Studio Installer is a lightweight application that allows modular installation of many different components. Developers use it to craft their ideal development environment. It optimizes the installation of your Visual Studio IDE and it makes sure you have everything you need, and nothing you don’t.

Launch the Visual Studio Installer

To modify your Visual Studio installation, you first need to launch the Visual Studio Installer, and then select a Visual Studio installation to modify. Let’s see how you can find the application via the Windows Start menu.

In the Windows Start menu, you can search for “installer”, and then select Visual Studio Installer from the results. Or you can also start typing the fully qualified name, and you should obtain the following result.

Visual Studio Installer
Visual Studio Installer

If for some reason you are unable to find the program you can try and look for it here:

C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe

Or, if you have Visual Studio 2022 open then go to Tools > Get Tools and Features… which opens the Visual Studio Installer.

Run Visual Studio Installer from Visual Studio 2022
Run Visual Studio Installer from Visual Studio 2022

If you have followed the instructions correctly, you should get the following Visual Studio Installer window:

Visual Studio Installer
Visual Studio Installer

One side note here. Make sure you are modifying the Visual Studio 2022 installer.

Next, navigate the the Individual Components tab. You can either search, or you can scroll down and find the following: .Net Framework project and item templates. This is the component that you are missing.

Enables .NET Framework project templates, item templates & related features for .NET Framework development.

Microsoft Documentation
Install Component: .Net Framework project and item templates
Install Component: .Net Framework project and item templates

Finally, click on the Modify button on the lower right corner, to start the download and install process.

When the installer finishes its work, you can launch Visual Studio 2022 and look for the ASP.NET Web Application (.NET Framework). It should be there.

Create ASP.NET MVC5 Web Project in Visual Studio 2022
Create ASP.NET MVC5 Web Project in Visual Studio 2022

Now, you should be able to create ASP.NET MVC5 Web Project in Visual Studio 2022.

More DevInDeep Tutorials:

Conclusion

Even though Microsoft is forcing us to use the improved .NET version of their cross-platform framework, there are situations where we still want to create Web and Desktop apps for Windows only. If that is the case, then this tutorial should help you to install support for ASP.NET applications under the old .NET Framework.

Hope you found this post helpful. If you have any questions regarding this topic, feel free to mail us at info@devindeep.com