gpt4 book ai didi

c# - System.Core 未添加到对程序集的引用

转载 作者:行者123 更新时间:2023-12-05 07:29:48 25 4
gpt4 key购买 nike

我目前正在开发一个 Aspnet MVC Web 应用程序。我正在使用 .NET Framework 4.6.1 和 Microsoft.AspNet.Mvc v5.2.6。

我将 Kendo.Mvc v2018.3.911.545 添加到我的项目中并开始使用 Grid Kendo。一开始完全没有问题。过了一段时间,我突然得到了以下错误:

The type 'Expression<>' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

我尝试了这些链接,但没有一个对我有用:

The type 'Expression<>' is defined in an assembly that is not referenced

VS2017 The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Compilation error in .NET 4.0 web.config - Linq not found

bogus intellisense error putting red squiggles all over razor views!!

VS 2015 IntelliSense: Assembly Not Referenced Error

此外,我不想将 Microsoft.Aspnet.Mvc 降级到 v.5.2.0,因为此操作会在 Kendo UI 和 razor 页面上产生新问题。

此外,我尝试将 .NET Framework 升级到 4.7.1 并降级到 4.5,但仍然没有用。我也真的不想降级 .NET Framework,因为虽然它不能解决我的问题,但它还会产生新的问题。

最佳答案

您在自己问题的评论中分享的代码应该按原样工作:

<dependentAssembly>
<assemblyIdentity name="System.Core" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>

至少在 VS2022 上,在 Web.config 文件中添加对程序集的引用后,错误并没有消失,但是只有在重新启动 IDE 之后。我不确定为什么,但这样做之后一切都是绿色的。

enter image description here

有关我的项目的其他信息:

  • 目标框架:.NET Framework 4.7.2
  • System.Web.MVC版本:v5.2.7.0
  • System.Web.MVC 运行时版本:v4.0.30319

关于c# - System.Core 未添加到对程序集的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52586699/

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