ASP.NET添加剃刀页面的Web应用程序没有网站,NO MVC [英] ASP.NET Add Razor page in Web Application not Web Site, NO MVC

查看:216
本文介绍了ASP.NET添加剃刀页面的Web应用程序没有网站,NO MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现了一个奇怪的事情在Visual Studio 2010。

I just found a strange thing in Visual Studio 2010.

我可以添加一个剃刀页面进入网站项目,但我不能这样做在Web应用程序项目。

I can add a Razor page into a Web Site project, but I cannot do it in a Web Application project.

我知道我可以创建一个ASP.NET MVC(1-4)项目,让我一个剃刀页面中添加进去。

I do know I can create a ASP.NET MVC(1-4) project which allows me to add a Razor page into it.

我查了网站之间的差异后(WS)项目和Web应用程序(WA)项目,这在我看来,WA是趋势,在大多数情况下,拥有更多的功能比WS。

After I checked the differences between Web Site(WS) project and Web Application(WA) project, it seems to me that WA is to trend to be in most cases and has more features than WS.

所以我的问题是:
Visual Studio 2010中可以让我们剃刀页面添加到WS项目(在模板列表中添加一个新页面时,你可以找到它),但是为什么它不在西澳项目模板提供剃刀页面?

So my question is: Visual Studio 2010 allows us to add a Razor page into a WS project(you can find it when adding a new page in the list of templates), but why it does not provide the Razor page in the template in the WA project?

我很好奇吧。等待您的答案:)

I'm curious about it. Waiting for your answers :)

干杯

推荐答案

创建一个新的,空的Web应用程序,当我有同样的问题。我想使用MVC。尽管添加所需的引用,它仍然不会让我的文件夹中创建通过右击文件。

I had the same problem when creating a new, Empty web application. I wanted to use MVC. Despite adding the references required, it still won't let me create files by right clicking on a folder.

不过,如果您已经在Visual Studio 2010中安装了SP1,您可以:

However, if you have SP1 installed on Visual Studio 2010, you can:


  • 右键点击>从模板添加>新建>剃刀MVC视图

希望这有助于。

这篇关于ASP.NET添加剃刀页面的Web应用程序没有网站,NO MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆