*How do I add MVC 4 to an existing .net framework web application 4.8 that includes controller and view folders, and routing information.

iqworks Information Quality Works 331 Reputation points
2024-05-02T20:34:23.9733333+00:00

This question starts in https://learn.microsoft.com/en-us/answers/questions/1662118/how-do-i-add-an-mvc-template-to-my-web-app-project 

I thought that is should be more specific in my question, so, I created a new post with more a more specific title.

I am using visual studio 2019. The project is called MBSAnalysisWebApp. This project has a target framework of 4.8.. I took your suggestion and tried to add an existing item to my project, but it calls up file explorer. I looks like it expects you to add a file.

When I choose to add a new item, I get these choices:

MVC 5 View Page (Razor)

MVC 5 View Page with Layout (Razor)l

MVC 5 Layout Page (Razor)

MVC 5 Partial Page (Razor)

I see I need to add MVC 4 to my .net 4.8 web app project. I ran this in the nuget console : "NuGet\Install-Package Microsoft.AspNet.Mvc -Version 4.0.30506"

It showed that the system.web.mvc.dll was in the references now, but no controller or view folders?

I searched for the scenario where an MVC 4 was added to .net framework 4.8, but didnt find any.

as usual, thanks for any advice or suggestions

Developer technologies | Visual Studio | Other
Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 30,191 Reputation points Microsoft External Staff
    2024-05-03T03:11:24.2733333+00:00

    Hi @iqworks Information Quality Works,

    Support for MVC 4 is limited. You cannot create MVC4 templates in VS2019.

    Only ASP.NET MVC 5.x is supported in VS2017 and above,

    https://developercommunity.visualstudio.com/t/using-aspnet-mvc4-in-vs2017/284556

    You can only open existing MVC 4 projects that run successfully by installing MVC 4 components.

    User's image

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.