开发者

MVC 3 Razor Intellisense

I have Visual Studio 2010 Ultimate installed with SP1 RTM and MVC 3 RTM installed as well. The problem I am having is that the Razor intellisense will not work. When I start a new MVC 3 project with the Razor engine and open a view, the Razor highlighting works but all of the key words are underlined with red squiggles and the intellisense doesn't work. I do not have ReSharper installed.

I have tried reinstalling MVC 2, MVC 3, and Visual Studio 2010 Ultimate but intellisen开发者_Python百科se will still not work for Razor. Has anyone else had this issue, or know how to fix it?

Thanks in advance!


When uninstalling make sure to uninstall all of the below:

  • Microsoft ASP.NET MVC 3
  • Microsoft ASP.NET MVC 3 - Visual Studio 2010 Tools Update (you might not have this one installed)
  • Microsoft ASP.NET Web Pages
  • Microsoft ASP.NET Web Pages - Visual Studio 2010 Tools

Now install the following:

  • ASP.NET MVC 3 Tools Update

Razor Intellisense should work.


Its possible that you're not opening Razor files with the right editor. This is particularly likely if you were using Razor before the RTM came out, when there was no Razor editor.

Right-click on one of your .cshtml files and select "Open With", and make sure that the default is the "Razor Editor" and not the HTML or XML editors. Pre-RTM, the auto-detection would have picked the XML editor as the correct one based on the presence of XML tags.

Also, you said that you've reinstalled everything, but the actual Intellisense support comes from a package called "ASP.NET Web Pages Visual Studio Tools", which is installed as part of MVC. If you are actually using the Razor editor and have no Intellisense, uninstall MVC3 and the web pages tools, and reinstall them both.


This solution is worked for me :)

When i uninstalled (i should never install) SP1 update for visual studio, my razor support had gone away, i try to uninstall and install MVC3 Tools update many times but it didn't worked.

After that I right click the installer and extract the package and i saw the seperated .msi installers in it. I installed one by one which are i needed and it worked :)

I hope it helps other user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜