Setting debug = false in web.config as part of the assembly

Is it possible to specify aspnet_compiler to set debug = false in the web.config file?

I intend to automate this as part of the nant build process. I am open to suggestions other than XML parsing

+6
build-automation nant
source share
5 answers

Have you ever thought about using <xmlpoke> ?

 <xmlpoke file="${Build.WebConfig}" xpath="/configuration/system.web/compilation/@debug" value="false"> </xmlpoke> 

NAnt Home

XML Poke Documentation

+10
source share

I would suggest using completely different configuration files for each environment (prod, test, staging in our case). Depending on the build, you will just use the required configuration, clutter, less fuss. Hanselmen has an example of how to do this in Visual Studio, and if you read the first comment, Phil Hack 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 the convert web.config

+3
source share

How I solve this, I have separate configuration files for each deployment environment:

  • Products
  • Phased
  • Development

After the "build script" I copy the configuration files for the type that I am creating. For example, in the Staging phase, I copied the file / configs / staging / * .config to the root of the website. Then my script will call aspnet_compiler to compile the application.

+2
source share

I use this tool as part of my build chain. It allows you to set conditional configuration parameters in a single XML file based on build settings.

http://xmlpreprocess.sourceforge.net/

0
source share

Using web deployment projects, you can swap various sections of your web.config after assembly.

0
source share

All Articles