Today the Gu announced the first preview of ASP.NET MVC 3, which included the new Razor view engine. I’ve been really excited about it as I feel it makes our views a lot prettier than before with Web Forms view engine. It will also be a lot quicker and smoother to type without all those messy
To the point! I am currently upgrading an existing site to use MVC 3 and Razor. However in this first preview of MVC 3 we won’t have any File Colorization or IntelliSense in .cshtml files. This means it will look like we’re editing in Notepad. It got me wondering if there was a way to at least get some colorization, more specifically HTML colorization. I wandered around in the options of VS2010, and eventually found the place where I could map an extension to a different colorization.
This is how you get HTML colorization in
- Open Tools menu.
- Choose Options…
- Go to Text Editor, and third choice; File Extension.
- Enter cshtml as Extension and choose HTML Editor in the dropdown.
- Click Add and OK. Now try to open a .cshtml file – you should get HTML colorization.
Remember to remove this setting when VS2010 officially gets Razor colorization and IntelliSense.
That’s it. Hopefully it will be a little bit easier on your eyes.