How to add Razor to MVC 3 after updating from MVC 2 hard drive?

I have an MVC 2 project that I am trying to upgrade to MVC 3, but using the tool, I got an error that the SLN file is invalid, even works fine for me.

so I update them manually, it means

In the sln file, change the keys and change the configuration file in the views and in the main directory and delete the MVC 2 DLL and add the MVC 3 DLL.

now my project is converted to MVC 3, but the little problem that I like when I try to add views, I can not find this option, it only shows me aspx in a new window. I need MVC 3 shaving points and layout.

how can i get a razor in the menu (add a new View option)

+6
source share
1 answer

You need to do a little more with the project file. check this post, similar problem: ASP.NET MVC3, Enable razor


rephrase:

I fixed this by changing the ProjectTypeGuids element in the .csproj file to the following:

<ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> 

Now I can choose Razor or ASPX as a viewer.


check if this problem fixes.

Personally, I would create a new MVC3 project and copy over the controllers and views and work on them as I need.

Remember that if you create a new razor view, you will need to delete the existing aspx or ascx view, as they are checked first before cshtml (razor).

+2
source

Source: https://habr.com/ru/post/887915/


All Articles