How to set web.config to "debug = false" via MSBuild Extension Pack?

I have a WCF service application, and debug mode is set for web.config (debug = true):

    <compilation debug="true">
        <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </assemblies>
    </compilation>

I would like to set this to "debug = false" via the MSBuild Extension Pack (version 3.5.8.0) so that the released version is always automatically in non-debug mode.

Obviously, I need to use the XmlFile class , but it does nothing.
My build file is as follows:

  <Target Name="Test">
    <MSBuild.ExtensionPack.Xml.XmlFile TaskAction="UpdateAttribute" File="$(MSBuildProjectDirectory)\$(BuildDir)\ServiceClient\web.config" XPath="/configuration/system.web/compilation[@name='debug']" InnerText="false"/>
  </Target>

When I run the build script, I only see this:

Test:  
XmlFile: C:\MyProject\Build\ServiceClient\web.config 
Update Attribute: /configuration/system.web/compilation[@name='debug']. Value:

, ... .
, MSBuild web.config -, "Date Modified" Explorer , , script. . diff MSBuild, .

Key Value InnerText, .

, ?

+3
1

:

  <Target Name="Test">
    <MSBuild.ExtensionPack.Xml.XmlFile TaskAction="UpdateAttribute" File="web.config" XPath="/configuration/system.web/compilation" Key="debug" Value="false" />
  </Target>

3.5.8.0

+4

Source: https://habr.com/ru/post/1781703/


All Articles