Warm tip: This article is reproduced from serverfault.com, please click

c#-无法加载System.Threading.Tasks.Extensions

(c# - Unable to load System.Threading.Tasks.Extensions)

发布于 2019-12-03 11:54:52

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

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

当我尝试运行项目并连接并从数据库中获取数据时,出现以下错误,提示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:\Workspaces\PS\RConfig\RConfig.cs:line 1113
       at RAdmin.Global.Application_Start(Object sender, EventArgs e) in C:\Workspaces\PS\RAdmin\Global.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文件安装到程序集。我仍然遇到相同的错误。

如果你需要任何其他信息,请告诉我。

任何帮助,我们真的很感激。

Questioner
User12111111
Viewed
11
Jitendra Morya 2019-12-03 20:12:17