首页 > 解决方案 > System.Runtime,版本=4.1.0.0 例外

问题描述

在我的控制台 C# 应用程序中,我有以下几行:

ServerManager sm = new ServerManager();
SiteCollection sc = sm.Sites;

Microsoft.Web.Administration我根据需要添加了引用 。但我得到了例外:

无法加载文件或程序集 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。该系统找不到指定的文件。

标签: c#.net-standard-2.0

解决方案


尝试修改 app.config 条目以匹配新版本的 packages.config,如下所示。

您必须检查 packages.config 以了解确切版本

<dependentAssembly>
  <assemblyIdentity name="System.Runtime" publicKeyToken="b0123f7facd50a3a" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.6.0" />
</dependentAssembly>

推荐阅读