Is there a way to add a designer view for the cshtml firewall editor?

I use the built-in tool that we developed to parse razor patterns with generated models. The fact is that now it requires downloading a template every time to parse it. I wanted to add edior, so I could look at cshtml while writing it, so I thought the best way is to make it a visual extension of the studio.

I researched the Internet, and it seems to me that you can write your own editor for VS, but then I need to write the editor itself, which I do not want to do.

Is there a way to use the existing razor editor built into VS2012 and add a preview tab with my control that gets the current text from the razor editor so that I can parse it and show the preview?

The reason for using an existing editor is coloring, intellisense, error handling, etc.

+7
source share
1 answer

There is no native support for the design representation of Razor files (CSHTML and VBHTML). This is partly due to the fact that they are a combination of code and HTML, which range from "very complex" to "super impossible" for parsing.

Having said that, a super-spell function called Page Inspector has appeared in VS2012, which can show you a real visualized page along with the code generated by it (for example, your Razor representation) and the comparisons between them, even if some of the content came from the layout page or partial view.

Check http://msdn.microsoft.com/en-us/library/hh420390(v=VS.110).aspx and find the “Page Inspector” section, which includes links to several blog posts and videos that describe this feature in depth.

Here's an excerpt:

Page Inspector is a tool that displays a web page (HTML, web forms, ASP.NET MVC, or web pages) directly in the Visual Studio IDE. You can use Page Inspector to check the source code and the final result. For ASP.NET pages, you can use the Page Inspector to determine which server-side code generated the HTML markup displayed in the browser. Page Inspector works even when ASP.NET's default add and minimize features are enabled.

+9
source

All Articles