title: Replacing IIS rewrite rules in web.config transform
body: <p>I have some IIS rewrite rules that I want to vary by environment. The development rewrite rules are in the web.config file, then at the end of the web.test.config file I have:</p>
  
  <pre><code>    &lt;appSettings&gt;
           ...Some app settings tranforms here
      &lt;/appSettings&gt;
      &lt;system.webserver&gt;
              &lt;rewrite xdt:Transform="Replace"&gt;
                &lt;rules&gt;
                  ... rules here
                &lt;/rules&gt;
              &lt;/rewrite&gt;
            &lt;/system.webserver&gt;
          &lt;/configuration&gt;
  </code></pre>
  
  <p>My app settings are getting transformed when I deploy to test, but by IIS rewrite rules are not. I was hoping the entire <code>&lt;rewrite&gt;</code> section would simply be replaced with the one in the transform file (as per <a href="http://msdn.microsoft.com/en-us/library/dd465326.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/dd465326.aspx</a>), but nothing is changing.</p>
  
  <p>I have tried putting <code>xdt:Transform="Replace" xdt:Locator="Match(name)"&gt;</code> on the individual rules too:</p>
  
  <pre><code>&lt;rule name="Test rule" stopProcessing="true" xdt:Transform="Replace" xdt:Locator="Match(name)"&gt;
  </code></pre>
  
  <p>But again this makes no difference.</p>
  
  <p>Is it even possible to replace rewrite rules in the web.config and if so, what am I missing?</p>