January 12th, 2011

How to get Razor syntax support in Visual Studio 2010

What’s Razor?
Razor is a simple-syntax view engine that is released as part of ASP.NET Model View Controller (MVC) 3. Read more about the syntax on ScottGu’s blog or on ASP.NET

How can I get Razor syntax support in Visual Studio 2010?
It’s simple. Install the MVC3 RTM bits via Web Platform Installer or download the installer directly to run it yourself. 
Both the options run AspNetMVC3Setup.exe and it installs Visual Studio 2010 support for Razor syntax in addition to other components bundled in the exe.

What does ASPnetMVC3Setup.exe install for Visual Studio to support the syntax?
The ASP.NET MVC 3 installer includes the following components. Components in bold add the support.

  • ASP.NET MVC 3 runtime components
  • ASP.NET MVC 3 Visual Studio 2010 tools
  • ASP.NET Web Pages run-time components
  • ASP.NET Web Pages Visual Studio 2010 tools
    This component is responsible to add support for Razor syntax. It also installs Razor (VB and C#) Templates for Websites.
  • Microsoft Package Manager for .NET (NuGet)
  • An update for Visual Studio 2010 that enables support for Razor syntax.
    It’s an update for Visual Studio 2010 that enables support for ASP.NET webpages that are developed by using Razor syntax in websites and in web projects.

Known issues
Please check the MVC3 release notes from here for a list of known issues.


You might encounter the following issues if you install Visual Studio 2010 SP1 Beta + MVC 3 RTM. 

  • Squigglies are shown for ‘WebSecurity’ when I Open Account/Login.cshtml
  • Database.open shows squigglies when I opened a Bakery site in Visual Studio using the VS button in WebMatrix, when build the error goes away.
  • Running format document on the default template’s ChangePassword in VB causes a compilation problem because it formats the <li> elements incorrectly to the same line as End if
  • Language intelliSense is not automatically shown when typing inside html attribute where html intellisense is already up. For example, <img src=”@

Workaround for the above four issues would be to uninstall Visual Studio 2010 SP1 Beta or install Visual Studio 2010 SP1 RTM (whenever it’s released).

Hope this Helps,
Deepak Verma

0 comments

Discussion are closed.