Search code examples
razorvisual-studio-2015razorengine

Visual Studio 2015 - Associate custom file extension with cshtml editor


I have a file with custom extension which contains Razor Syntax. I would like open this file as cshtml to see highlighted Razor Syntax.

What kind of editor should I associate in Tools->Options->Text Editor->File Extension with my custom extension?

I've already tried all editors from the combobox but without success. When I change the extension to cshtml then Razor Syntax is highlighted.


Solution

  • Unfortunately it looks like this may not be possible - see this question.

    Personally, I'm using the RazorEngine to generate HTML emails and all my templates use .cshtml extensions for this very reason. I don't have any particular reason to change it.