Is it possible to instruct the aspnet_compiler to set debug=false in the web.config?
My intention is to automate this as part of the nant build process. I am open to suggestions other than xml parsing
Is it possible to instruct the aspnet_compiler to set debug=false in the web.config?
My intention is to automate this as part of the nant build process. I am open to suggestions other than xml parsing
Have you thought about using <xmlpoke>
?
<xmlpoke file="${Build.WebConfig}"
xpath="/configuration/system.web/compilation/@debug"
value="false">
</xmlpoke>
I would suggest using entirely different config files for each environment(prod, test, staging in our case). Depending on the build you would just use the required config, no mess, less fuss. Hanselmen has example on how to do this in Visual Studio and if you read the first comment Phil Hack has got it working with NAnt.
<target name="configMerge">
<copy file="${sourcefile}"
tofile="${destinationfile}" overwrite="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
</target>
In Addition, if you are using VS 2010 you can now use web.config transforms
The way I tackle this is I have seperate configuration files for each deployment environment:
Upon the "build script", I copy the config files for the type I am building. For example, on Staging I would copy the /configs/staging/*.config into the root of the website. Then, my script would call aspnet_compiler to compile the application.
I've been using this tool as part of my build chain. It allows conditional configuration settings within a single xml file based on build settings.
Using web deployment projects you can swap out different sections of your web.config after your build.
© 2022 - 2024 — McMap. All rights reserved.