Precompile a asp.net4 mvc3 website using visual studio 2010

不羁岁月 提交于 2019-12-12 07:12:36

问题


What is the best way to pre-compile a asp.net4 mvc3 website with all its view files using visual studio 2010?

I'm a little confused because MS provides multiple solutions that sound very similar.

Web Deployment Projects

http://blogs.msdn.com/b/webdevtools/archive/2010/05/26/visual-studio-2010-web-deployment-projects-rtw-available-now.aspx

Web Deployment Tool

http://www.microsoft.com/download/en/details.aspx?id=25230

or can I just do all this from the default VS2010 SP1 without additional addons?

Can someone clarify?


回答1:


When you build or publish your project, the website is already compiled. Only the views are dynamically compiled. If you want your views to be compiled also, you can edit your web project file. Change this line:

<MvcBuildViews>false</MvcBuildViews>

to:

<MvcBuildViews>true</MvcBuildViews>

To be able to edit the project file within visual studio you have to unload the project first (right-click, Unload Project) and then right click the project again and choose Edit Project. When you made the change, your views will be automatically be build also. This is not something you want to do during development, build time significantly increases.



来源:https://stackoverflow.com/questions/7166820/precompile-a-asp-net4-mvc3-website-using-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!