出版pre-编译ASP.net MVC的VS2010 [英] Publishing Pre-Compiled ASP.net-MVC VS2010

查看:114
本文介绍了出版pre-编译ASP.net MVC的VS2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现它们使用生成后事件几种解决方案。

I found several solutions which use Post-Build event.

有没有办法为编译意见发布 ASP.NET MVC网站的 (适用于prevent第一用户视图延迟),但不进行编译他们的开发环境(编译网站更快)?

Is there a way to publish ASP.NET MVC web site with compiled views (to prevent first user view delay) but do not compile them in development environment (to compile site faster)?

感谢您!

P.S。理想情况下是配置一键在Visual Studio 2010发布功能

P.S. Ideally it would be to configure One Click Publish feature in Visual Studio 2010

修改

我的理解< AspNetCompiler VirtualPath =TEMPPhysicalPath =$(WebProjectOutputDir)/> 做同样的事情。

As I understood <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" /> does the same thing as

 <MvcBuildViews>true</MvcBuildViews>
 <EnableUpdateable>false</EnableUpdateable>

但对于早期版本的

but for early versions

我的.csproj的样子

My .csproj looks like

...
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <MvcBuildViews>true</MvcBuildViews>
    <EnableUpdateable>false</EnableUpdateable>
...

和看法precompile很好,但我不能得到部署单个库就像ASP.NET的应用程序。这就是为什么第一次加载页面的延迟依然存在...

and views precompile fine but I can't get a single library for deployment like with Asp .net applications. That's why first load page delay still exist...

请帮忙

推荐答案

您可以配置生成后事件当你在Release模式编译只编译的意见,这样它不会在开发过程中你慢下来(当你presumably编译调试模式下)。

You can configure the post-build event to compile views only when you compile in Release mode so that it does not slow you down during development (when you presumably compile in Debug mode.)

例如,当项目在Release模式编译在.csproj的以下节点将只编译意见。

For example, the following node in a .csproj will only compile views when the project is compiled in Release mode.

  <Target Name="AfterBuild" Condition="'$(Configuration)'=='Release'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
  </Target>

这篇关于出版pre-编译ASP.net MVC的VS2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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