【问题标题】:Async PCL assmeblies mismatch异步 PCL 组件不匹配
【发布时间】:2013-07-04 10:54:06
【问题描述】:

我有一个使用 Microsoft.Bcl.Async Nuget 包的 PCL 项目,该包有一些通用代码。现在,当我在 WP8 项目中引用程序集并使用一些异步方法时,我收到以下错误:

Cannot convert source type 'System.Threading.Tasks.Task<byte[]> [System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]' to target type 'System.Threading.Tasks.Task<byte[]> [mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]'

我尝试添加以下程序集绑定并将 Microsoft.Bcl.Async Nuget 包添加到我的 WP8 项目中,但似乎没有任何效果。

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

有谁知道我做错了什么,或者我还能尝试什么?

非常感谢

【问题讨论】:

    标签: .net windows-phone-8 async-await portable-class-library


    【解决方案1】:

    你可以试试:

    1. 到处卸载包
    2. 从所有项目中删除任何引用 System.Runtime、System.Threading.Tasks 或 Microsoft.Threading.* 的绑定重定向。
    3. 在每个项目中重新安装包,包括 WP8 项目

    在 WP8 项目中应该没有引用 System.* 的绑定重定向 - 如果有,也将它们删除(您可能会点击 https://nuget.codeplex.com/workitem/3072)。

    【讨论】:

      猜你喜欢
      • 2020-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 2021-11-26
      • 2019-07-12
      • 2017-10-30
      相关资源
      最近更新 更多