So I'm trying to replace a dependentAssembly when someone adds my nuget package to their code.
The assembly I want to change is:
<dependentAssembly>
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
Therefor I use this xml file and help from: Web.config transforms - the missing manual
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Replace" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name:'Common.Logging.Core')">
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
But I'm getting the error: An error occurred while applying transformation to 'web.config' in project: 'blabla' has an invalid qualified name.
In noticed when I change "Replace" to "Remove" it is removing the complete dependentAssembly but somehow afterwards it adds the same dependentAssembly to the web.config again. Maybe because Common.Logging.Core dependency get's added after the web.config transform?
And maybe is this the reason that the Replace isn't working?