문제

I have an WCF Service Application and the web.config is set to debug mode (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 that to "debug=false" via 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 doesn't do anything.
My build file looks like this:

  <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:

No errors, no warnings...nothing.
I can see that MSBuild found the web.config and did something with it, because "Date Modified" in the Explorer is set to right now, which wasn't the case before I ran the script. But there is no visible change in the file. I used a diff tool to compare the file versions before and after MSBuild, and they are identical.

I also tried to set Key and Value instead of InnerText, but that doesn't help either.

Any idea what I'm doing wrong?

도움이 되었습니까?

해결책

Try this:

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

I am using extension pack version 3.5.8.0

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top