【问题标题】:Binding Redirect With Portable Class Library使用可移植类库绑定重定向
【发布时间】:2015-05-05 10:42:16
【问题描述】:

是否可以在可移植类库中应用 bindingRedirect 或者是否有替代方法?

我们有一个 PCL 引用另一个使用 System.Net.Http.Formatting (5.2.3.0) 和 System.Net.Http.Primitives (4.2.22.0) 的 PCL。当前使用此 PCL 的代码使用以下绑定重定向:

<?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>

我正在尝试在 PCL 中将此代码用于 Windows 8 Phone/Desktop 应用程序,但无法将 app.config 添加到项目中。 System.Net.Http.Formatting 参考了 System.Net.Http.Primitives 的 1.5.0.0 版本

【问题讨论】:

    标签: c# windows-8 portable-class-library


    【解决方案1】:

    事实证明,我的项目设置为面向 Windows 8.1、Windows Phone 8.1 和 .NET 4.5。

    当我删除 .NET 4.5 要求时,它开始使用引用 dll 中的 System.Net.Http.Formatting 版本,而不是尝试从 .NET 框架中使用它

    【讨论】:

      猜你喜欢
      • 2014-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-18
      • 1970-01-01
      • 1970-01-01
      • 2012-07-13
      相关资源
      最近更新 更多