Right, I keep having to do this, and keep having to look this up, so here it is.
If you want to do a web transform for an assembly binding redirect it can be a bit tricky. The assembly details are in an
<assemblyIdentity /> element, and the
<bindingRedirect /> is its sibling. Yeah, I don’t know why it was designed this way; I’m assuming alcohol was involved. Yes, having the oldVersion and newVersion attributes in the same element at the assembly’s identity would be much simpler.
Anyway, it is what it is. An alternative is to replace the entire
<dependentAssembly /> element, but the locator becomes a bit more fiddly. Still, it works. See this example – the locator on the parent element is checking the name of the child assemblyIdentity.
<dependentAssembly xdt:Transform="Replace" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Runtime')"> <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" /> <bindingRedirect oldVersion="0.0.0.0-188.8.131.52" newVersion="184.108.40.206" /> </dependentAssembly>