Why can't Visual Studio preview MVC Razor View (.cshtml) pages similar to asp/aspx pages?

10,819

It is indeed just a case of Razor being so new. No doubt preview will work with Razor in a future version (who knows, perhaps a service pack to 2010 will add this). However, as @marcind points out, this is speculation on my side...

Share:
10,819
Rich Bianco
Author by

Rich Bianco

Available to help with PowerBuilder Projects 25+ years nearly-dedicated PB Broad range of ancillary languages Full Life Cycle, Sprint, Jira, Trello All Major DBMS, Oracle my Favorite Visual Source Safe, some Git Fair, Trustworthy, Confident Seasoned, Steady, Focused Rate is competitive in ball park of sixty five depending on everything. You would expect a high level of competency with PowerBuilder, moderate DB design, all major DBMS's, and many common languages and tools.

Updated on June 08, 2022

Comments

  • Rich Bianco
    Rich Bianco almost 2 years

    I enjoy working with ASP.NET MVC 3 using the Razor view engine, but am embarrassed to admit that not having the ability to preview the pages (.cshtml) in the Visual Studio designer negatively affects my productivity.

    Is there a fundamental reason why Visual Studio won't preview Razor pages or is it simply a matter of Razor being relatively new (and released out of band), in which case we might expect preview in Visual Studio 2012?

  • marcind
    marcind almost 13 years
    Commenting here since this answer is marked as the solution. In fact, it's nothing more than speculation. There are currently no plans to add a Razor designer to Visual Studio 2010.
  • Tae-Sung Shin
    Tae-Sung Shin about 11 years
    Of course, it will increase productivity with a right designer. Can you imagine expression blend for asp.net mvc? But reality is that there is no single web design software that can do it. At this point, the only way is to open whole page in a series of browsers. That's a pain.
  • Rich Bianco
    Rich Bianco almost 8 years
    I was re-reading this, wow this was six years ago so definitely no plans for razor preview unless it's already possible and I haven't seen it.
  • Marc Roussel
    Marc Roussel about 5 years
    It's possible with RenderRazorViewToString. If you search the web, there's a small code used by many this small code can be used to make an extension in VS that would let you right click a .cshtml and have an option Preview which of course would have fake data merged with the view. I only speculate. You can even find many examples on stackoverflow already and this is just a google search result for you in a not too english version : gist.github.com/Draw507/330e907ddbec85e3d5c2f07f5c9a2a0e
  • Shimmy Weitzhandler
    Shimmy Weitzhandler almost 5 years
    Any news as of VS 2019?