Remove parent of matched locator

Posted by Ilan on Stack Overflow See other posts from Stack Overflow or by Ilan
Published on 2012-11-03T10:58:47Z Indexed on 2012/11/03 11:00 UTC
Read the original article Hit count: 424

Filed under:

Is there a way to locate a node based child properties? I need to run a web.config transform to remove the 2nd <dependentAssembly> in the following:

<runtime>
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <!-- Don't want to delete this one -->
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
  </dependentAssembly>
  <!-- This is the one I want to delete -->
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
    <codeBase version="11.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2011.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL"/>
  </dependentAssembly>
 </assemblyBinding>
</runtime>

Finding the <assemblyIdentity> is easy enough, but I need to delete the parent <dependentAssembly> (and <codeBase>). If there was a "xdt:Transform="RemoveParent" this would do the trick, but AFAIK there isn't.

Alternatively if there was a Locator I could use on the <dependentAssembly> which would match children, then that could work too.

© Stack Overflow or respective owner

Related posts about web-config-transform