Search code examples
c#asp.netasp.net-mvcrazor

Visual Studio displaying errors even if projects build successfully in Razor html


Intellisense not working for any razor html tags. Also showing Red line in all razor html tags (@Html.TexBox, @Html.DropdownList MultiSelect etc)

Three types error are showing in Visual Studio Error Window.

Error #1:

The type arguments for method 'System.Web.Mvc.Html.InputExtensions.TextBoxFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>, System.Collections.Generic.IDictionary)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Error #2:

One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?

Error #3:

Error 40 The type arguments for method 'System.Web.Mvc.Html.InputExtensions.HiddenFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Please see the attached link for more information.

enter image description here
enter image description here


Solution

  • Problem solved deleted all the contents from the following folder.

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

    Thank you all for your time. :)