19. November 2013
This is also the answer to the question "Why intellisense is not working properly in old projects opened with Visual Studio 2013?". The short answer is that some objects(like the Html Helper) in MVC5 use different assemblies than those in MVC 3 and earlier. As a result, you may not be able to see their full functionality. For example, when you type in the View "@Html.ActionLink()
", it will be underlined as invalid. Note that the project will still build and work properly, only the VS intellisense is broken.
There are already a number of useful guides on upgrading MVC templates. I found the following very useful:
Basically, you have to update all versions
of your assemblies to the ones that are shown in the table for MVC 5. Most important are the "System.Web.Mvc" versions, so make sure all of them are set to "188.8.131.52". However, even if you followed all the steps in the guide, it is still possible that the intellisense of the Html Helper does not work properly. The easiest way to fix this:
1. Open the web.config in the Views folder.
2. Locate <system.web> --> <pages>, usually in an MVC 3 project it will look like this:
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
3. In the above-mentioned guide, it is suggested that you change all versions to 22.214.171.124, but this still did not do the trick for me. It is better to delete everything after validateRequest="false".
So what is left is:
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
<add assembly="System.Web.Mvc, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
4. As a last step - rebuild your solution and reload the project
. Everything should work just fine.