1

We have an ASP.Net MVC 3 project which will also be serving an existing set of .html files. These files do have some "@" Razor code inserted in them, however we do not want to change the extensions.

Is there any way to get VS to use the same code formatting it uses for .cshtml files for these files as well, to make it easier to see the Razor code highlighted in yellow.

TIA

Matt

Matt
  • 1,370
  • 2
  • 16
  • 40
  • possible duplicate of [Can I serve .html files using Razor as if they were .cshtml files without changing the extension of all my pages?](http://stackoverflow.com/questions/5110970/can-i-serve-html-files-using-razor-as-if-they-were-cshtml-files-without-changin) – balexandre May 18 '11 at 13:29
  • @balexandre, not the same at all - this one is asking about intellisense – Buildstarted May 18 '11 at 14:24
  • I was able to register `html` files to be edited by Visual Studio using the Razor Editor, however, because it doesn't know what type of razor file to parse it as it doesn't work. (doesn't know if it's c# or vb) – Buildstarted May 18 '11 at 14:32
  • @BuildStarted if it's Intellisense, then the question is http://stackoverflow.com/questions/2922770/can-visual-studio-2010-do-inc-file-syntax-highlighting either way, it's an existing question, should be close, and next time, search before asking :o) – balexandre May 18 '11 at 16:41
  • @balenandre except that neither of those are specific to razor - especially since the RazorEditor only works when certain conditions are met :) - either way there's no answer – Buildstarted May 18 '11 at 16:47

1 Answers1

0

Check out RazorCodeLanguage.Languages, which lets you set which file extensions use which Razor parser (CS/VB).

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
  • How and where should I use `RazorCodeLanguage.Languages`? The documentation you link is not very explicit I must say. Could you point mein the right direction please? – Luiso Jun 21 '16 at 14:36
  • 1
    This answer explains it well :) http://stackoverflow.com/a/24347759/25124 (as does the one linked in the comments on the question) – Danny Tuppeny Jun 21 '16 at 18:02