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

前端 未结 28 1323
渐次进展
渐次进展 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:09

    Well, I got it fixed by correcting the assembly reference in /Views/web.config, see the image:

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

    In my case the solution was to move the ConnectionString inside the Web.Config. This statement should be after AppSettings section.

    0 讨论(0)
  • 2020-12-24 05:10
    • Close the cshtml file
    • Rebuild solution
    • Open cshtml file
    • Still errors? Restart Visual studio
    • Still errors? Use ctm1988's answer
    0 讨论(0)
  • 2020-12-24 05:10

    If you get this in only one or two CSHTML files... it's a corrupt file.

    I've had this happen with a corrupt file that has some hidden unicode characters. Try copying all the text of the document to a fresh notepad instance. Clear the contents of the original file and save... if the file length is > 0, there's something awry.

    Delete the file and save your notepad instance over the old version. All the errors went away for me.

    I've had this happen a couple of times in my solution. Not sure what's causing it, but I suspect it's Resharper screwing up when it starts to swallow huge chunks of memory into the abyss.

    Am I the only one who has a love / hate relationship with Resharper?

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