ASP.NET MVC Razor designer

2020-02-16 12:06发布

I am introducing ASP.NET MVC to a new team and one of the questions that comes up often is "Is there a designer view"

Even if it's not for layout is there an IN visual studio design view for ASP.NET MVC3 using the razor view engine.

7条回答
Bombasti
2楼-- · 2020-02-16 12:16

I use a web browser window and set the url my localhost in place of the designer. view > "other windows" > "web browser". I then split the windows vertically or horizontaly.

查看更多
你好瞎i
3楼-- · 2020-02-16 12:17

No, there is no designer. It would likely be difficult for a designer to even know what is meant by Razor code in many cases.

It's really not so difficult to just use your web browser as a viewer. You can make changes to the HTML without having to recompile, just make the change, save, and refresh your browser.

EDIT (8/2/2013)

Since this answer was originally written, Microsoft has released Visual Studio 2012 which includes a feature called Page Inspector, which while not a true "designer" in the way that the question was written, it does give a much nicer semi-live preview mode. This has been improved in Visual Studio 2013 (which was RTM'd today, 10/17/13).

查看更多
劫难
4楼-- · 2020-02-16 12:18

No, in general you should try and steer clear from visual designers. The combination of HTML/CSS/Javascript is something that just cannot be done well with visual designers and the short term pain of learning these manually will be well worth it. Once you know these well you will be coding in a cleaner and quicker way. I often use Expression Web to do initial layouts before copying it to Visual Studio.

查看更多
你好瞎i
5楼-- · 2020-02-16 12:21

I was able to work using the following trick:

  1. change the razor file's extension to .html
  2. Open the document
  3. with the document open, change file extension back to .cshtml

Congratulations, you now have a designer's view of the razor file. If you need razor intellisense, close and re-open it.

查看更多
贪生不怕死
6楼-- · 2020-02-16 12:26
虎瘦雄心在
7楼-- · 2020-02-16 12:31

I know I am late to the party, but..

You can trick the IDE as mentioned above, but if you are building applications in MVC, you should be comfortable in code view. It is more productive and most of the responsive design and css implementation can give you false results in design view. Designer is useful in WebForms. But with the Browser Link feature in Visual Studio 2013, there is no longer any reason to trick your IDE, you can have one-to-many browsers open and get live updates back and forth from browser to visual studio. Can't beat that! The browser is where it's at!

Browser Link!

Install the following and you will be golden!

Microsoft Visual Studio 2013 Update 3
Web Essentials (Dependent on VS Update 3)

查看更多
登录 后发表回答