In ASP.NET MVC 4.5.2 Framework.
after typing
@Html.LabelFor()
or
@Html.EditorFor()
in view
I\'m getting Error: The
I did ALL of the above and in the end found that what solves it for me (on a .net framework 4.7.1 site with MVC 5.2.4) was adding this into the root web.config within <compilation>
-
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
I have tried most of these, what eventually worked for me was unloading the project, edit the csproj file, and add the following:
<Reference Include="System.Core" />
https://stackoverflow.com/a/38371981/2335660
I've had the same problem with missing assembly and it happened that VS2017 build has not copied it properly into the Bin folder. These steps helped me:
- Navigate to the web project's References node
- Find the reference to System.Core
- Open the VS Properties Window
- In the properties window, change Copy Local: False to True
from this comment: CS0012: The type '#####Any type#####' is defined in an assembly that is not referenced
I have run in the same issue as you, albeit much later. The issue was that I was not able to access Razor views (.cshtml) as I was getting an error stating that I had a missing assembly reference, namely System.Web.Mvc
, even though it was in the project references. After investigation, I have noticed that the installed NuGet version was 5.2.3, while the project required 5.2.0. The solution is to downgrade the MVC version.
Confirm all the dialogs and you are ready to go.
This happened with one of my views - all the others were fine. I did the following: