title: Nuget web.config.install.xdt not transforming
body: <p>I'm having problems figuring out how to transform the web.config file when my NuGet package it installed.  It's doing some of the transformations, but not all of them.</p>
  
  <p>Here's the untouched web.config file that I need to modify upon installation of my NuGet package:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;authentication mode="None" /&gt;  ***** I want this removed *****
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
      &lt;modules&gt;
        &lt;remove name="FormsAuthentication" /&gt;  ***** I want this removed *****
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Here's what I want as the result:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
      &lt;add key="MvcMailer.BaseURL" value="" /&gt;
      &lt;add key="SecurityGuardEmailFrom" value="info@email.net" /&gt;
      &lt;add key="SecurityGuardEmailSubject" value="Your Password has been reset." /&gt;
      &lt;add key="SecurityGuardEmailTemplatePath" value="~/MailerTemplates/ResetPassword.html" /&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
      &lt;authentication mode="Forms"&gt;
        &lt;forms loginUrl="~/SGAccount/Login" timeout="2880" /&gt;
      &lt;/authentication&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
      &lt;modules&gt;
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This is transformed web.config file in the MVC application, which is incorrect:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true" /&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
      &lt;add key="MvcMailer.BaseURL" value="" /&gt;
      &lt;add key="SecurityGuardEmailFrom" value="info@email.net" /&gt;
      &lt;add key="SecurityGuardEmailSubject" value="Your Password has been reset." /&gt;
      &lt;add key="SecurityGuardEmailTemplatePath" value="~/MailerTemplates/ResetPassword.html" /&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;authentication mode="None" /&gt;  ***** Not removed when it should be *****
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
      &lt;authentication mode="Forms"&gt;
        &lt;forms loginUrl="~/SGAccount/Login" timeout="2880" /&gt;
      &lt;/authentication&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
      &lt;modules&gt;
        &lt;remove name="FormsAuthentication" /&gt;  ***** Not removed when it should be *****
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>And this is my web.config.install.xdt file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
    &lt;system.web&gt;
      &lt;authentication mode="None" xdt:Transform="Remove" xdt:Locator="Match(mode)" /&gt;
      &lt;authentication mode="Forms" xdt:Transform="Insert"&gt;
        &lt;forms loginUrl="~/SGAccount/Login" timeout="2880" /&gt;
      &lt;/authentication&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
      &lt;modules&gt;
        &lt;remove name="FormsAuthentication" xdt:Transform="Remove" xdt:Locator="Match(name)" /&gt;
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I've read all the documentation on the Nuget.org site about how to use the XDT transformations, and it even works on this tester site; <a href="https://webconfigtransformationtester.apphb.com/" rel="nofollow">https://webconfigtransformationtester.apphb.com/</a>, but it doesn't work in action.</p>
  
  <p>I'm stumped.  Any suggestions on how to make this work?</p>