Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 code formatting on CSHTML lowercases generic model types

When formatting code a Razor cshtml file in Visual Studio 2012 (with Ctrl + K + D) if model is a generic type, VS makes it all lowercase. For example:

@model IEnumerable<Content>

converts to (consider all lower case content):

@model IEnumerable<content>

after formatting. This cause the code not to compile. Is this a bug or I'm missing something? How it can be fixed?

like image 217
Afshar Mohebi Avatar asked Sep 19 '12 08:09

Afshar Mohebi


1 Answers

This issue is from Visual Studio 2012 not recognizing it as razor code and treating it as regular HTML. I believe this is a bug with VS 2012 and will hopefully get fixed soon. As a temporary fix, you can do this:

  1. Goto TOOLS -> OPTIONS
  2. Select Text Editor -> HTML -> Formatting
  3. Set the Client Tag drop down to "As entered"

Hope this helps.

like image 199
Chris - Haddox Technologies Avatar answered Sep 18 '22 16:09

Chris - Haddox Technologies