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

前端 未结 28 1324
渐次进展
渐次进展 2020-12-24 04:39

In ASP.NET MVC 4.5.2 Framework.

after typing

@Html.LabelFor()
or 
@Html.EditorFor()

in view

I\'m getting Error: The

相关标签:
28条回答
  • 2020-12-24 05:05

    For me, there was an option under the project menu to "Enable C# 6.0/VB 14". Selecting this option did the trick. Previously I tried modifying the web.config, restarting Visual Studio, etc as was suggested in this post.

    0 讨论(0)
  • 2020-12-24 05:06

    Deleting [projectName].csproj.user file from the project directory helped for me.

    0 讨论(0)
  • 2020-12-24 05:07

    If none of the answers work use this one. I faced the same issue! Actually configuration.cs file in migrations folder was missing/deleted. I did delete migrations folder and also did delete migrations table from database. Next in Package Manager Console (PM) used following commands:

    Enable-Migrations -Force
    Add-Migration Initial
    update-database
    

    This process recreated the configuration.cs file and everything worked perfectly!

    0 讨论(0)
  • 2020-12-24 05:07

    Check your project properties to get the Target framework. I resolved this issue in my project by matching for my target framework .NET framework 4.6.1 MVC 5.2.3 was the apt solution. I got that MVC version from NuGet.

    0 讨论(0)
  • 2020-12-24 05:09

    In my case this message was shown only when Resharper was turned on. I have cleared Resharper cache, restarted VS, turned Resharper off and turned it on again. The message has dissapeared.

    0 讨论(0)
  • 2020-12-24 05:09

    Add the System.Core.dll file to the bin folder manually. Restart VS and build project. Solved for me

    Had design errors in all views on @Html helpers and on my Kendo grids.

    Adding System.Core assembly in Web.config did nothing, nor did downgrading the MVC version. And error when trying to add reference to System.Core manually:

    A reference to 'System.Core' could not be added. This component is already automatically referenced by the build system.

    Make sure to check that TargetFramework in project properties matches the one in project web.config.

    Screenshot of bin folder

    0 讨论(0)
提交回复
热议问题