dependentAssembly being added by our NuGet package - not sure why?

Topics: Ecosystem
Feb 26, 2013 at 9:37 PM
Edited Feb 26, 2013 at 9:37 PM
I've got an internal NuGet package that is a .NET 4.5 assembly referencing System.Net.Http. When we install this package NuGet keeps adding the following:
  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
to the app.config - which then breaks the app because it should actually be using the .NET 4.0 version. I've tried adding this:
<frameworkAssemblies>
    <frameworkAssembly assemblyName="System.Net.Http" targetFramework=".NETFramework4.5">
</frameworkAssemblies>
to the NuSpec which then adds the System.Net.Http reference correctly (though it's not automatically needed), but I'm still getting the binding redirect added.

I've checked the assembly in dotPeek and while initially it was referencing both mscorlib v2 & 4 (as we had .NET 2 assemblies) I've stripped them out so it only references mscorlib v4 to no affect.

Any pointers? Thanks!
Feb 27, 2013 at 9:19 PM
Our logic for adding the binding redirect entry is quite aggressive and unfortunately there's not a way to turn it off. David Kean has filed an issue here (http://nuget.codeplex.com/workitem/3072). Perhaps this will solve your problem?