无法加载 System.Threading.Tasks.Extensions

Unable to load System.Threading.Tasks.Extensions(无法加载 System.Threading.Tasks.Extensions)

本文介绍了无法加载 System.Threading.Tasks.Extensions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于 .net 框架 4.5.1 的 Web 项目.我们正在尝试为该项目添加 PostgreSQL 支持.使用 Nuget,我已将 4.0.4 npgsql 安装到项目中.在引用下,我看到以下内容被添加到项目中.

I have a web project build on .net framework 4.5.1. We are trying to added PostgreSQL support for the project. Using Nuget, I have installed 4.0.4 npgsql to the project. Under references, I see the following being added to the project.

  1. Npgsql - 4.0.4.0 - 运行时版本 v4.0.30319
  2. System.Threading.Tasks.Extensions - 4.2.0.0 - 运行时版本 v4.0.30319

当我尝试运行项目并连接并从数据库中获取数据时,我收到以下错误提示 FileNotFoundException:

When I tried run the project and connect and get the data from the database, I am getting the following error saying FileNotFoundException:

    System.TypeInitializationException
      HResult=0x80131534
      Message=The type initializer for 'com.rsol.RConfig' threw an exception.
      Source=RConfig
      StackTrace:
       at com.rsol.RConfig.getInstance() in C:WorkspacesPSRConfigRConfig.cs:line 1113
       at RAdmin.Global.Application_Start(Object sender, EventArgs e) in C:WorkspacesPSRAdminGlobal.asax.cs:line 528

    Inner Exception 1:
    TypeInitializationException: The type initializer for 'com.rsol.Db.DbMgr' threw an exception.

    Inner Exception 2:
    FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

    Inner Exception 3:
    FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

使用 Nuget 安装的 System.Threading.Tasks.Extensions 未加载到项目中.当我检查 System.Threading.Tasks.Extensions 引用的属性时,该 dll 文件存在于该位置.我还尝试使用 gacutil 将 System.Threading.Tasks.Extensions.dll 文件安装到程序集.我仍然遇到同样的错误.

System.Threading.Tasks.Extensions which is installed using Nuget is not getting loaded to the project. When I checked the properties of System.Threading.Tasks.Extensions reference, the dll file exists in the location. I have also tried installing System.Threading.Tasks.Extensions.dll file to assembly using gacutil. I am still getting the same error.

如果您需要任何其他信息,请告诉我.

Please let me know if you need any additional information.

非常感谢任何帮助.

推荐答案

更新 Nuget 包

https://www.nuget.org/packages/System.Threading.Tasks.Extensions/

会解决你的问题

这篇关于无法加载 System.Threading.Tasks.Extensions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法加载 System.Threading.Tasks.Extensions

基础教程推荐