Migration of .NET Framework 4.5 to 4.6.1 throws errors for Views HTML Help

IDE used :: VS.NET 2015, 2017

Update version :: 4.5 to 4.6.1

There are some HTML helpers in the viewer code like @ Html.TextBoxFor and @ Html.PasswordFor. It shows red lines below them, and at runtime the page throws an exception.

My asp.net solution contains over 30 projects internally. I have updated the target framework to 4.6.1. I tried to follow the solution suggested in VS 2015 IntelliSense post : Build error without reference . I tried to copy build links inside web.config but no luck so far. I also tried to open the project in the latest VS.NET 2017. But again I get the same problem.

Please suggest correcting these errors. Now this is getting nervous and I spent a lot of time trying to fix it.

  • The type 'Expression <>' is defined in an assembly that is not referenced. You should add assembly reference 'System.Core, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'.

  • 'ModelErrorCollection' does not contain a definition for "Any" and no extension method "Any" that takes a first argument of type "ModelErrorCollection" can be found (are you missing using directive or assembly reference?)

enter image description here

+3


source to share


1 answer


This was a weird problem. My project had several assembly binding redirects that were defined inside web.config.

  <!--<dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0"/>
     </dependentAssembly>-->

      



I commented out the above lines in web.config and restarted ID.NET VS.NET. Finally, the problem was resolved.

0


source







All Articles