3

I am currently developing a Aspnet MVC Web application. I am using .NET Framework 4.6.1 and Microsoft.AspNet.Mvc v5.2.6.

I added Kendo.Mvc v2018.3.911.545 to my project and started using Grid Kendo. At first there was no problem at all. After some point, I got following error all of a sudden:

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

I tried these links and none of them worked for me:

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

Also, I don't want to downgrade Microsoft.Aspnet.Mvc to v.5.2.0 because this action generates new issues at Kendo UI and razor pages.

Also, I tried upgrading .NET Framework to 4.7.1 and downgrading to 4.5 and still no use. I also don't really want to downgrade .NET Framework because while it does not solve my issue, it also generates new ones.

KaraKaplanKhan
  • 734
  • 1
  • 14
  • 31

1 Answers1

0

The code you shared in the comment to your own question should work as it is:

<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>

At least on VS2022, after adding the reference to the assembly in the Web.config file, the error IS NOT gone, but ONLY AFTER restarting the IDE. I'm not sure why, but after doing this everything was green.

enter image description here

Additional information about my project:

  • Target framework: .NET Framework 4.7.2
  • System.Web.MVC version: v5.2.7.0
  • System.Web.MVC runtime version: v4.0.30319
carloswm85
  • 1,396
  • 13
  • 23
  • 1
    I have changed my position and working at different place. So, unfortunately I am unable to test your answer but if there is anyone correcting your answer I will gladly accept it as correct answer for your good efforts to answer this question. – KaraKaplanKhan Dec 07 '22 at 13:25