I'm playing around with MVC 5 RC 1 in Visual Studio 2013 RC. Works very well.
Now I upgraded an existing MVC 4 project in VS 2012 to MVC 5 the same way as described here
I also changed the web.config(s) - see "upgrading from MVC4 to MVC5"
Everything (build, run web app, even intellisense) works perfectly except the syntax highlighting of Razor/C# code in views.
I also tried it with an MVC 5 project created in VS 2013. Same result. So I assume VS 2012 doesn't "understand" the new assemblies?!
Any known workaround or ideas to get highlighting back?
For me, my issue was that I had my build files being output to a directory other than
bin
. Once my files we're output tobin
, then my syntax highlighting came back.One way to fix this is to create a post-build action which copies the files in the project-rooted bin folder (vs a filter outside of the project) to your target directory.
The following article explains: http://www.dennisonpro.info/managing-intellisense-in-razor-views-with-mvc-5-using-custom-builds-in-visual-studio-2013/
This answer claims that VS2012 can't understand Razor 3, so you (and me) will have to upgrade to VS2013
I got this answer from Microsoft developer:
So the accepted answer is true for now but we can plan to soon have this support in VS2012 as well.
install the "ASP.NET and WebTools 2013.1 for Visual Studio 2012" in the Microsoft Platform Installer
I am currently using a workaround to get the IntelliSense working in VS2012 (I assume that this would not work properly a) if I was using VS2013 for the same project; b) if I tried using Razor 3 features):
Change the web.config to use old
webpages
version:To make sure that this does not impact the production in any way I added a web.config transformation:
Unfortunately this workaround has issues (that I have noticed so far):
Html.RenderPartial()
are not recognized and show up as error in the designer).Microsoft released a new version of ASP.NET Web Tools for VS 2012. After installing syntax highlighting is back again.
http://blogs.msdn.com/b/webdev/archive/2013/11/18/announcing-release-of-asp-net-and-web-tools-2013-1-for-visual-studio-2012.aspx
Installing VS 2012 Update 4 was not enough.
A set of offline installers is available. The offline installers are easier to use than the Web Platform Tools invoker (WebNode11Pack.exe @ ~114KB):