Visual Studio 2010 未将 .CSHTML(Razor 视图引擎)设置为内容

发布于 2024-09-27 03:47:28 字数 358 浏览 0 评论 0原文

我一直在尝试将 ASP.NET MVC 3 Beta 应用程序部署到我的托管。它支持所有必要的技术,通过反复试验,我将所需引用的 Copy Local 设置为 True。然后我收到错误,我的应用程序找不到视图。它列出了它尝试过的 .cshtml 文件。我的项目中有这些文件,但它们没有部署。我发现 Visual Studio 2010 没有像 .aspx 文件那样将 .cshtml 文件的属性 Build Action 设置为 Content

有没有办法让 Visual Studio 自动将 .cshtml 设置为内容,或者我必须手动将其设置到我添加的每个 Razor 视图?

I've been trying to deploy my ASP.NET MVC 3 Beta Application to my hosting. It supports all the necessary technologies and through trail and error I set the needed references' Copy Local to True. Then I got the error that my app cannot find the view. It listed .cshtml files it tried. I had those files in my project but they weren't deployed. I found that Visual Studio 2010 doesn't set .cshtml files' property Build Action as Content as it does for the .aspx files.

Is there a way to make Visual Studio automatically set .cshtml as Content, or will I have to set this manually to every Razor View I add?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

手心的温暖 2024-10-04 03:47:28

在等待最终版本时,它将具有完整的 Visual Studio 集成和 Intellisense 与 Razor 视图引擎,您可以查看 这篇博文,特别是以下部分:更改文件类型的默认构建操作< /em>。

While waiting for the final release which will have full Visual Studio integration and Intellisense with the Razor view engine you may checkout this blog post and especially the section: Changing The Default Build Action For a File-Type.

孤独患者 2024-10-04 03:47:28

我的团队也遇到了这个问题。尽管我们都知道陷阱,但很容易忘记更改构建操作,最终导致运行时错误。

我在 Connect 上提交了一个错误来解决这个问题。请投票并发表评论,以便这个问题得到一些关注。

http://connect.microsoft.com/VisualStudio/feedback/details/619539/mvc3-razor-views-and-partial-views-cshtml-are-not-marked-as-content

My team has been running into this problem as well. Even though we're all aware of the gotcha, it's too easy to forget to change the build action, and as a result you end-up w/ a runtime error.

I filed a bug on Connect to address this. Please up-vote and comment so this issue gets some traction.

http://connect.microsoft.com/VisualStudio/feedback/details/619539/mvc3-razor-views-and-partial-views-cshtml-are-not-marked-as-content

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文