1
votes

Is it possible to apply a bindingRedirect in a Portable Class Library or is there an alternative?

We have a PCL that references another PCL that uses System.Net.Http.Formatting (5.2.3.0) and System.Net.Http.Primitives (4.2.22.0). The current code using this PCL is using the following binding redirect:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-4.2.22.0" newVersion="4.2.22.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

I am trying to use this code in a PCL for a Windows 8 Phone/Desktop app, but can't add an app.config to the project. System.Net.Http.Formatting has a reference to version 1.5.0.0 of System.Net.Http.Primitives

1

1 Answers

0
votes

It turns out my project was set to target Windows 8.1, Windows Phone 8.1 and .NET 4.5.

When I removed the .NET 4.5 requirement, it started using the System.Net.Http.Formatting version from the referenced dll rather than trying to use it from the .NET framework