Search code examples
asp.netasmxweb.config-transform

Remove ASMX documentation in web.config transform


I'm able to successfully remove the ASMX WSDL help generator by adding this to my web.config

  <webServices>
      <protocols>
          <remove name="Documentation"/>
      </protocols>
  </webServices>

I'm also able to do some basic transformations to my config files as I publish to my debug and release configs doing things like this:

    <add key="UseEncrypted" xdt:Transform="Replace" xdt:Locator="Match(key)" value="true"/>

I'm having trouble however getting a combination of these two to work. For example, I'd like to have my debug config to not have the <remove> tag, but my release should include the <remove> documentation tag.

Is what I'm trying to accomplish possible, and if so - can you please give some guidance?


Solution

  • The solution to my issue was to add xdt:Transform="Remove" to the protocols section.

    <system.web>
        <webServices>
            <protocols xdt:Transform="Remove">
                <remove name="Documentation"/>
            </protocols>
        </webServices>
    </system.web>