How to Downgrade Razor 3 and fix the issue that CSHTML not work in VS10,12 ?

Posted by Anirudha on Geeks with Blogs See other posts from Geeks with Blogs or by Anirudha
Published on Mon, 04 Nov 2013 02:11:52 GMT Indexed on 2013/11/04 9:56 UTC
Read the original article Hit count: 200

Filed under:

Originally posted on: http://geekswithblogs.net/anirugu/archive/2013/11/04/how-to-downgrade-razor-3-and-fix-the-issue-that.aspx

Few days ago I migrate a project to MVC 4 and suddenly I have seen that MVC project’s cshtml file is no longer working. The problem happen because my project is now based on Razor 3 RC and VS12 doesn’t even have support it. (Remember that VS team will ship support in VS update 4). My migration update it to Razor 3 (which is not related to MVC 4, MVC 4 used old version of Razor 2).

 

So how to fix the problem. Since VS update 4 in development and MVC 3 support exist in both old Version of VS (10,12) then better to migrate back our Razor to old version so we can use our project in VS 10 or 12.

If your project have Razor 3 and it seem that Syntax highlighting doesn’t work for you then I suggest you to try this Nuget package https://www.nuget.org/packages/UpgradeMvc3ToMvc4

Remember that this will not be succeed. What you need to do is delete package folder in your project and now open the packages.config remove all entry of package now.

 

Now Run this command PM> Install-Package UpgradeMvc3ToMvc4

If this is failed then see what thing make error in console. simply remove the reference and try again. Now run it and see this will work.

 

After run this you will see that WebGrease Dll have a version number issue. Simply update it to version 1.5.2 and now you have ready your project to run it in .net 4. If you do bin deployment then you don’t need to have installed MVC 4 on server either.

Remember that MVC 5 is based on .net 4.5 which simply means you can’t run it in VS10. until VS12 update 4 MVC 5 cshtml page will be work as simple html pages (syntax highlighting and intellisense).

Smile

Thanks for read my postWinking smile

© Geeks with Blogs or respective owner