Visual Studio 2015 not syntax highlighting razor n

2019-01-05 08:10发布

My Razor views in VS2015 RC are not showing the proper coloring for C# code. My project was working fine in VS2013, but it isn't in 2015, and it's not giving me any Intellisense on the C# code. The solution builds and the site runs fine.

I tried the following to no avail

  • disabling all Visual Studio extensions
  • deleting my .suo file
  • removing the project and re-adding it to the solution

How can I fix this?

Example:

21条回答
你好瞎i
2楼-- · 2019-01-05 08:44

You should only remove the ".vs" folder in your project.(The .vs folder is hidden)

Be careful ResetUserData remove all customization on Visual Studio.

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-05 08:45

I had the same problem and had to download and install "Microsoft ASP.NET and Web Tools" and "Web Essentials". After doing this syntax highlighting and Razor intellisense started working again.

查看更多
叛逆
4楼-- · 2019-01-05 08:45

Above doesn't work but I managed with:

  • Uninstalling (from Windows Program And Features) Web Developer Tools for VS 2015, RC, Update 1
  • Installing (from VS Installer -> Modify) Web Developer Tools (it's another version of above)

So the problem was that VS installer didn't install Web Developer Tools recognizing already installed, incompatible version as the proper one.

查看更多
不美不萌又怎样
5楼-- · 2019-01-05 08:47

I installed Visual Studio Community Edition 2015 (after using Visual Studio Community Edition 2013 for a long time) and faced the same issue. I tried all the above solutions but nothing helped.

Finally, close Visual studio and deleted the following folders -

C:\Users\Allwyn\AppData\Roaming\Microsoft\VisualStudio\14.0
C:\Users\Allwyn\AppData\Roaming\Microsoft\VisualStudio\14.0

... and it works now!!!

查看更多
迷人小祖宗
6楼-- · 2019-01-05 08:54

After Updating Visual Studio 2015 Update 1 I had same issue. I tried all the answers but did not work for me.

The fix for me was going to programs and properties > Visual Studio community edition > Change. I clicked on modify.

In the list make sure to put a check mark on "Microsoft Web Developer Tools" under "Windows and Web Development" .

It was not checked in my list howewer :/

enter image description here

查看更多
7楼-- · 2019-01-05 08:54

The only thing that worked for me was to change the project's "Output Path" to bin\ (It used to be bin\Debug):

  1. Right-click on the project,
  2. Click on Properties and navigate to Build,
  3. Scroll to the last section titled "Output",
  4. Change the value in the text box labeled Output path: to bin\
查看更多
登录 后发表回答