gpt4 book ai didi

asp.net - 无法加载文件或程序集System.Runtime,版本=4.1.2.0

转载 作者:行者123 更新时间:2023-12-02 23:55:28 26 4
gpt4 key购买 nike

突然,添加一些 NuGet 包(主要与 ASPNET Identity 相关)后,它开始显示此错误:

FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

我的目标是.Net Framework 4.7.1。我尝试安装 NuGet 包 System.Runtime 4.3.0,但没有帮助。web.config文件有引用:

<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0"/>
</dependentAssembly>

bin文件夹中没有System.Runtime.dll。

有什么想法吗?

我使用 Visual Studio 2017 15.5.5。

更新:

我在 .csproj 文件中使用 PackageReference 条目,因此这不是packages.config 的问题。

似乎某些依赖项未加载。

最佳答案

程序集绑定(bind)可能是错误的。

删除 app.config 或 web.config AssemblyBinding 部分。然后在“包管理器”窗口中运行此 BindingRedirect:

Get-Project –All | Add-BindingRedirect

可选:如果升级所有项目的框架版本,则需要重新安装所有项目的所有 Nuget 包。要轻松做到这一点,请使用此包管理器脚本:

Get-Project –All | % { Get-Package -ProjectName $_.ProjectName | % { update-package $_.Id -reinstall -ProjectName $_.ProjectName -ignoreDependencies } }

然后运行上面的绑定(bind)重定向代码。

关于asp.net - 无法加载文件或程序集System.Runtime,版本=4.1.2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48503930/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com