Razor Intellisense Not Working VS2010 SP1Rel MVC3 from WPI Win7 x64

前端 未结 12 1557
迷失自我
迷失自我 2020-12-10 12:42

I have Visual Studio 2010 /SP1 / MVC 3 (With April Tools Update) installed on a machine with a fresh install of Windows 7 64-bit Professional.

I do not have resharp

相关标签:
12条回答
  • 2020-12-10 13:08

    If you have MVC4 and MVC3 installed you need to add this to appsettings in web.config (in root and in Views folder) to use MVC3

    <appsettings>
        <add key="webpages:Version" value="1.0.0.0">
        ...
    </appsettings>
    

    Also check your references in root web.config, they should included these versions

    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    

    Re-open your solution for settings to take effect

    0 讨论(0)
  • 2020-12-10 13:08

    I was experiencing the same issue. It started to happen randomly when I changed the view engine in the Views web.config to a custom one. It is a known problem VS2010 Intellisense has issues with recognizing reserved words when custom view engine is in place or when a view inherits from a custom view page.

    Everyone running into Razor Intellisense issues should check this out. None of the above fixes (reinstalling VS, rapplying SP1, reapplying MVC3 Tools Update) did help.

    0 讨论(0)
  • 2020-12-10 13:15

    I just wasted 2 hours of my life on this. What happened to me is that the web.config file got checked in wrong and was no longer Unicode UTF8. When VS 2010 opened the solution, it checks the web.config file for the appsettings:

    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="true" />
    

    Since the file couldn't be read by normal means, it just skipped it entirely, causing VS to think you needed to reinstall MVC... I just wanted to post this in case someone else runs into the same problem for an easy fix.

    0 讨论(0)
  • 2020-12-10 13:17

    We ran into issues because it appears the compiler uses the 32-bit MSBuild when building the Razor views, even if you have all of your projects set to 64-bit or Any Cpu. Our web project would not compile when we forced it to 64-bit because the razor views were being built in 32-bit and failing because some of the views were referencing a project that had a 3rd party 64-bit dll referenced.

    0 讨论(0)
  • 2020-12-10 13:17

    I had the same problem, I fixed it simply by installing Visual studio 2010 SP1. Everything is working fine since then. I hope this helps you.

    You can download it from here: http://www.microsoft.com/download/en/details.aspx?id=23691

    Good luck

    0 讨论(0)
  • 2020-12-10 13:18

    I know it's been a while since the last post, but I fixed mine by uninstalling MVC 2 and MVC2 VS Tools, and only leaving MVC 3 installed.

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