Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting debug=false in web.config as part of build

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

like image 374
Cherian Avatar asked Mar 24 '09 16:03

Cherian


2 Answers

Have you thought about using <xmlpoke>?

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

NAnt Home Page

XML Poke Documentation

like image 149
Michael La Voie Avatar answered Oct 20 '22 01:10

Michael La Voie


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

like image 33
cgreeno Avatar answered Oct 20 '22 01:10

cgreeno