asp.net-mvc – 编译时mvc视图检查与msbuild
发布时间:2020-05-24 02:38:03 所属栏目:asp.Net 来源:互联网
导读:我发现在ASP.NET MVC项目的.csproj中有以下目标: Target Name=AfterBuild Condition=$(MvcBuildViews)==true AspNetCompiler VirtualPath=temp PhysicalPath=$(ProjectDir)..$(ProjectName) //Target 这将
|
我发现在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 – 如何将网页添加到gridview
- asp.net-mvc – MVC 3 Ajax.ActionLink不能正常工作
- asp.net – Response.Redirect和线程被中止错误?
- asp.net – HtmlGenericControl(“br”)呈现两次
- asp.net-mvc – 如何使用MVC控制器返回JSON
- ASP.Net:为什么我的按钮的点击/命令事件没有在转发器中绑定
- asp.net – How2:在HttpModule中挂钩的事件,用于将js链接放
- asp.net-mvc – @ Html.ActionLink如何添加一个查询字符串
- asp.net-mvc – 如何将ASP.Net MVC路径段中的1或0映射到布尔
- asp.net-core – 在ASP.NET Core中使用Entity Framework 6
推荐文章
站长推荐
- asp.net-mvc-3 – 如何有效地从自相关表中加载数
- asp.net-mvc-3 – 在Html.BeginForm()中使用DELE
- asp.net-mvc – 如何使基于列表的编辑器模板正确
- 在Asp.Net Membership中手动更改用户名
- asp.net-mvc-4 – 组合ASP.NET MVC4捆绑和requir
- asp.net – 实体框架ObjectContext重用
- asp.net-web-api – OAuthBearerAuthenticationM
- asp.net-mvc-3 – 从单控制器操作返回多个部分视
- ASP.NET自带对象JSON字符串与实体类的转换
- asp.net – 如何在没有文件扩展名的情况下制作AS
热点阅读
