Reputation: 19702
I use VS 2008 to develop and I use CCNet to build, test and deploy our applications to a staging server. I would like to be able to remove the debug="true"
setting from web.config as part of the deployment process.
I know I could just set <deployment retail="true"/>
in machine.config, but I don't always have that much access the servers we deploy to. I could just write a bit of code to strip the setting from the web.config, but I was wondering if there was a way I could do it out of the box with msbuild or CCNet.
Upvotes: 5
Views: 1170
Reputation: 61865
You can use the MSBuild Community Tasks and do:
<XmlUpdate
XmlFileName="web.config"
XPath="//configuration/system.web/compilation/@debug"
Value="false"/>
Or you can use various built-in Visual Studio transformation techniques:
<configuration xmlns:xdt="...">
<compilation xdt:Transform="RemoveAttributes(debug,batch)">
</compilation>
</configuration>
NB this is a duplicate of Setting debug=false in web.config as part of build (Which I found too late; have put a vote to close on this)
Upvotes: 6
Reputation: 57
My solution for CCNET with the Web.config transformation:
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>E:\VersionesCC\Trunk_4\SBatz\Gertakariak_Orokorrak\GertakariakMS\Web</workingDirectory>
<projectFile>GertakariakMSWeb2.vbproj</projectFile>
<targets>Build</targets>
<timeout>600</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
<buildArgs>
/noconsolelogger /p:Configuration=Release /v:diag
/p:DeployOnBuild=true
/p:AutoParameterizationWebConfigConnectionStrings=false
/p:DeployTarget=Package
/p:_PackageTempDir=E:\Aplicaciones\GertakariakMS2\Web
</buildArgs>
</msbuild>
</tasks>
Upvotes: 0
Reputation: 33867
Microsoft have supplied web deployment projects for download - these are MS build projects that have a bit of a front end in VS - they allow you to swap out config sections.
Upvotes: 2