MVC3 编译视图很慢

发布于 2025-01-08 01:07:10 字数 314 浏览 0 评论 0原文

在 Visual Studio 2010 中处理 ac# MVC3 应用程序时,我通过编辑项目文件并将 Wonder 标志设置为 true 来打开视图编译

`<MvcBuildViews>false</MvcBuildViews>`

。我喜欢它,因为它意味着我可以整理我的观点并发现错误。

我现在唯一的问题是它不是很快! (我尝试过将其关闭,然后又恢复到全速。)

看起来它每次都会重新编译每个视图 - 我目前有大约 50 个视图,所以理想情况下它只会编译自上次以来已更改的页面。这有可能吗?

When working on a c# MVC3 app in Visual Studio 2010, I have turned on view compilation by editing my project file and setting the wonderful flag

`<MvcBuildViews>false</MvcBuildViews>`

to true. I love it as it means I can compile my views and catch errors.

The only problem that I have now is that it's not really quick! (I have tried turning it off and then it's back up to full speed.)

It looks like it recompiles every view every time - I have about 50 views at the moment, so ideally it would only compile the pages that have changed since last time. Is this at all possible?

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

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

发布评论

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

评论(2

断肠人 2025-01-15 01:07:10

我认为不可能在同一个项目中以这种方式进行编译。您可以尝试将视图提取到一个单独的项目中,并以这种方式进行设置。

http://www. chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/

I don't think its possible to compile that way in the same project. You could attempt to pull out the views into a separate project, and set it up that way.

http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/

天荒地未老 2025-01-15 01:07:10

据我所知,构建视图是一个要么全有要么全无的标志。

我建议在开发环境中关闭此选项,但在指向主开发分支的持续构建系统中打开它。这样,如果您提交的内容破坏了视图,您仍然可以收到一封电子邮件,而无需在开发过程中为每个构建添加大量时间。

As far as I know, building the views is an all-or-nothing flag.

I recommend turning this option off for development environments, but turning it on for a continuous build system that's pointing at your main development branch. That way you can still get an email if you commit something that breaks a view, without adding a lot of time to each build during development.

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