Can I view .html files using Razor Intellisense as if they were .cshtml files in Visual Studio 2010?

I got .Net MVC3 for processing .html (and another custom extension), like a .cshtml file, but VS2010 will not highlight Razor syntax or show Intellisense for it. How to make VS2010 recognize a .html file as a .cshtml?

+3
source share
1 answer

It's not so easy. If you see the source of asp.net mvc 3 , you can see the following things in the web pages folder:

File: RazorDebugHelpers.cs

// Trim the html part of cshtml or vbhtml
string outputExtension = extension.Substring(0, 3);

File: RazorCodeLanguage.cs

private static IDictionary<string, RazorCodeLanguage> _services = new Dictionary<string, RazorCodeLanguage>(StringComparer.OrdinalIgnoreCase) {
        { "cshtml", new CSharpRazorCodeLanguage() },
        { "vbhtml", new VBRazorCodeLanguage() }
    };

File: PreApplicationStartCode.cs

WebPageHttpHandler.RegisterExtension("cshtml");
WebPageHttpHandler.RegisterExtension("vbhtml");

Etc.

? mvc. - , , , , , . , , , .

+2

All Articles