Microsoft.Bcl.Async 正在尝试加载 System.Threading.Tasks 1.5.11.0
Microsoft.Bcl.Async trying to load System.Threading.Tasks 1.5.11.0
我已将 Microsoft.Bcl.Build/Microsoft.Bcl 和 Microsoft.Bcl.Async 添加到解决方案中我想使用 async/await 的一些项目中。
安装了 .Net4.5 的我的机器上一切正常。但是,当我在仅安装了 .Net4 的计算机上启动应用程序时,有时应用程序会崩溃并出现以下异常:
Could not load file or assembly 'System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
查看 StackTrace,异常似乎是在我们引用的第三方库中生成的。
当我分析Microsoft.Bcl.Async提供的Microsoft.Threading.Tasks.dll时,我看到它确实引用了System.Threading.Tasks版本1.5.11.0,但版本2.6.10.0包含在Microsoft.Bcl.
我是不是做错了什么?
我找到了解决办法!其实很简单。我只需要将 nuget 在 app.config 文件中添加的绑定重定向复制并粘贴到 *.exe.config 文件中。然后它就神奇地起作用了。轻松修复。
我已将 Microsoft.Bcl.Build/Microsoft.Bcl 和 Microsoft.Bcl.Async 添加到解决方案中我想使用 async/await 的一些项目中。 安装了 .Net4.5 的我的机器上一切正常。但是,当我在仅安装了 .Net4 的计算机上启动应用程序时,有时应用程序会崩溃并出现以下异常:
Could not load file or assembly 'System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
查看 StackTrace,异常似乎是在我们引用的第三方库中生成的。
当我分析Microsoft.Bcl.Async提供的Microsoft.Threading.Tasks.dll时,我看到它确实引用了System.Threading.Tasks版本1.5.11.0,但版本2.6.10.0包含在Microsoft.Bcl.
我是不是做错了什么?
我找到了解决办法!其实很简单。我只需要将 nuget 在 app.config 文件中添加的绑定重定向复制并粘贴到 *.exe.config 文件中。然后它就神奇地起作用了。轻松修复。