Is there a way to locate a node based on child properties? or to delete the parent of the matched node?
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.
Found the answer over here
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="RemoveAll"
xdt:Locator="Condition(starts-with(./_defaultNamespace:assemblyIdentity/@name,'Microsoft.VisualStudio.Enterprise.AspNetHelper'))">
</dependentAssembly>
</assemblyBinding>
</runtime>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With