asp.net mvc - Enabling MVCBuildViews based on Conditional Compilation Symbols -
is possible add conditional steps build check custom conditional compilation symbol , enable mvcbuildviews. i've found way based on build configuration
<propertygroup condition=" '$(configuration)|$(platform)' == 'release|anycpu' "> <mvcbuildviews>true</mvcbuildviews> </propertygroup>
but not sure how access compilation symbols instead.
the plan add symbol under project settings > build > conditional compilation symbols controls mvcbuildviews
assuming using c# need configure compiler use eg.test
symbol when building views , need override configuration in web.config
using following:
<system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="microsoft.csharp.csharpcodeprovider, system, version=2.0.3600.0, culture=neutral, publickeytoken=b77a5c561934e089" compileroptions="/define:test" //here need define symbol warninglevel="1" /> </compilers> </system.codedom>
if apply directly in web.config work define eg. test
every time. should use web.config transformations
symbol applied correct build configurations.
you can update projects created previous releases of mvc include build-time validation of views performing following steps:
1)open project file in text editor.
2)add following element under top-most element: <mvcbuildviews>true</mvcbuildviews>
3)at end of project file, uncomment <target name="afterbuild">
element , modify match following:
<target name="afterbuild" condition="'$(mvcbuildviews)'=='true'"> <aspnetcompiler virtualpath="temp" physicalpath="$(projectdir)\..\$(projectname)" /> </target>
Comments
Post a Comment