asp.net-mvc – 编译时mvc视图检查与msbuild
发布时间:2020-12-15 23:25:35 所属栏目:asp.Net 来源:网络整理
导读:我发现在ASP.NET MVC项目的.csproj中有以下目标: Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'" AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)..$(ProjectName)" //Target 这将检查.csproj中的MvcBuildViews bool
我发现在ASP.NET MVC项目的.csproj中有以下目标:
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)..$(ProjectName)" /> </Target> 这将检查.csproj中的MvcBuildViews bool属性,如果设置为true,则获取构建以检查视图. 我使用NAnt构建我的应用程序进行部署,是否可以让这个目标从msbuild命令行运行而不必修改csproj? (我希望它仅在部署时运行,而不是每个构建,因为它的慢速重新加载器在VS中捕获它) 如果没有,我如何将上述代码翻译成msbuild命令行,以便我可以修改我的部署脚本?这是我现在的脚本: <target name="Deploy" depends="init"> <exec basedir="." program="${DotNetPath}msbuild.exe" commandline=" src/MyProject.Web/MyProject.Web.csproj /nologo /t:Rebuild /t:ResolveReferences;_CopyWebApplication /p:OutDir=../../output/build/bin/ /p:WebProjectOutputDir=../../output/build/ /p:Debug=false /p:Configuration=Release /v:m" workingdir="." failonerror="true" /> <call target="tests"/> <call target="compress-js"/> <call target="compress-css"/> <call target="rar-deployed-code"/> </target> 解决方法
将属性MvcBuildViews设置为true应该可以工作.
<target name="Deploy" depends="init"> <exec basedir="." program="${DotNetPath}msbuild.exe" commandline=" src/MyProject.Web/MyProject.Web.csproj /nologo /t:Rebuild /t:ResolveReferences;_CopyWebApplication /p:OutDir=../../output/build/bin/ /p:WebProjectOutputDir=../../output/build/ /p:Debug=false /p:Configuration=Release /p:MvcBuildViews=true /v:m" workingdir="." failonerror="true" /> <call target="tests"/> <call target="compress-js"/> <call target="compress-css"/> <call target="rar-deployed-code"/> </target> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – URL重写 – web.config错误
- asp.net-membership – Asp.net会员 – 帐户被锁定
- 是否可以优化ASP.NET WebForms以便像ASP.NET MVC一样快速执
- asp.net-mvc-3 – 如何从@ Html.EditForModel()中排除一个字
- asp.net-mvc – 图像URL中的&符号MVC导致一个潜在危险的
- asp.net-mvc – 如何成功配置Common.Logging?
- .net – 此程序集由比当前加载的运行时更新的运行时构建,无
- asp.net – 如何在MVC 3中设置图表系列颜色?
- 在ASP.NET C中将byte []流式传输到Image
- 检测asp.net将用户重定向到登录页面
推荐文章
站长推荐
- .net – IAuthenticationRequest.RedirectToProv
- ASP.NET MVC2模型验证失败,非美国日期格式
- asp.net – 如何在控件中显示十进制值?
- asp.net – 使用成员资格数据在aspnet_profile表
- asp.net-core-2.0 – .net标准2.0中的Dbgeograph
- asp.net-mvc-2 – 带有数组/列表的ASP.NET MVC 2
- asp.net – Headerstyle-horizo??ntalalign无效
- asp.net-mvc-3 – MVC 3使用RenderPage更改视图中
- 认识ASP.NET配置文件Web.config
- asp.net-mvc – MVC5:@ Html.TextBoxFor(或Edit
热点阅读