Intellisense in mvc4 project not working in vs 201

2019-02-10 05:51发布

In my razor views the intellisense is not working. Are there any fixes for this? I'm using the newly released VS 2012 Professional and building a ASP.NET MVC 4 project. The intellisense in my razor views are not working. Is there any fix for this?

4条回答
叼着烟拽天下
2楼-- · 2019-02-10 06:10

What helped me was to delete the .csproj.user file. Additionally, I have also deleted a who bunch of other things: packages, .suo file, bin/ and obj/, I also did devenv.exe /setup, and devenv.exe /resetsettings, but what helped, I think, was exactly that - deleting the .csproj.user file.

查看更多
三岁会撩人
3楼-- · 2019-02-10 06:14

I've met the same problem in my working solution. However Intellisense still was working for new mvc4 projects created by VS wizard. When i compared my csproj file with the new csproj file i mentioned that for all referenced mvc assemblies were set options SpecificVersion=true and copy local = true. So i did the same for my project and problem disappeared.

查看更多
三岁会撩人
4楼-- · 2019-02-10 06:24

You might be experiencing issues which are covered in the "Known Issues and Breaking Changes" section when upgrading from MVC3 to MVC4 in this release notes post.

Follow the instructions in the "Installing ASP.NET MVC 4 breaks ASP.NET MVC 3 RTM applications" section to resolve the issue.

查看更多
手持菜刀,她持情操
5楼-- · 2019-02-10 06:30

I just had the same problem when using RazorGenerator.Mvc on any project. Creating a brand new MVC4 project worked well untill RazorGenerator.Mvc entered into the game. It may well be that the cause is any other.

For me, checking that MVC4 project is using the latest version of MVC4 with NuGet is what solved it.

Go to the Package Administrator and search for MVC. You'll find that Microsoft's MVC4 has two available packages, one called "Microsoft ASP.NET MVC 4" and another called "ASP.NET MVC 4", and it happens to be that both have the same version number: 4.0.20710.0

One of them (the no-Microsoft one) says "Legacy package" but most likely that's the one your projects are using. Uninstall that one with NuGet on all your projects and install the "Microsoft ASP.NET MVC 4" package instead.

Close and reopen every cshtml view you have in the screen and then reopen some (you may have to wait for a minute or two for highlighting to show up). If in five minutes the syntax highlighting does not show up, close and reopen Visual Studio 2012.

(Tried with Visual Studio 2012 Premium)

查看更多
登录 后发表回答