14

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?

2
  • 1
    I'm commenting on my own question here, any Microsoft employees around? Notice the number of views on this question, well above the average considering the age of the question so developers are looking... Commented Oct 1, 2011 at 23:03
  • 1
    Not having this feature feels like 1 step forward.. one step back.. 20% of the time when i actually need to see the Markup i wish i could see a "preview" just so i dont have to read into the HTML to insert an @ in place of a title placeholder.. the "preview" was a serious improvement in 2008.. cant believe it was acceptable to NOT have this..
    – hanzolo
    Commented Oct 21, 2012 at 5:58

2 Answers 2

0

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...

4
  • 7
    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.
    – marcind
    Commented Jun 1, 2011 at 18:15
  • 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. Commented Jun 6, 2016 at 4:57
  • 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 Commented Mar 5, 2019 at 20:04
  • 1
    Any news as of VS 2019? Commented May 5, 2019 at 7:39
-1

Because there is no designer for it. You can preview it by running it.

I disagree about the productivity. In the past, with the ASPX designer, my markup was often destroyed (maybe it's better now)

Nobody knows if a designer will be there in the future. But according to this page there is a workaround available.

1
  • 1
    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. Commented Feb 3, 2013 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.