views:

356

answers:

1

I'm using an Web Deployment project to do a few post build tasks on a website I'm deploying.

I want to use a FileUpdate task to update my web.config and change the compilation mode from debug="true" to debug="false".

So, from this

<compilation defaultLanguage="c#"
                 debug="true" />

To this

<compilation defaultLanguage="c#"
                 debug="false" />

My FileUpdateTask looks like this

<FileUpdate Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU'"
                Files="$(Configuration)\Web.Config"
                Regex="debug=\"true\""
                ReplacementText="debug=\"false\"" />

but that is completely invalid as you can't escape a quote in XML.

How else can I match the debug attribute in the Regex and have a valid ReplacementText value?

Cheers

+3  A: 

either use the XmlUpdate task from MSBuild Community Tasks or try a regex of:

Regex="debug=&quot;true&quot;"
Dave Markle