How can I get user type C# syntax highlighting wor

2019-01-05 10:27发布

Somehow part of my syntax highlighting for C# code has disappeared in the VS 2012 IDE. Uninstalling, rebooting, and reinstalling does nothing, nor does resetting the colors in the options dialog.

Here are some examples of items which all appear in default (black) that normally have color which don't:

  • Attributes
  • System classes
  • My own classes

And here are some keywords that still have color:

  • using
  • public
  • void
  • var
  • for

Has anyone else experienced this and managed to fix it?

19条回答
该账号已被封号
2楼-- · 2019-01-05 10:53

For me "Productivity Power Tools 2012" was the cause. Nothing suggested here helped. After removing the Power Tools the colors came back.

查看更多
萌系小妹纸
3楼-- · 2019-01-05 10:54

If anybody runs in to the same problem for Visual Studio 2013 as I did, the only solution that worked for me was to first close VS2013 and then delete the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors

After reopening VS2013, my syntax highlighting for types was restored.

Prior to deleting the registry key, I noticed that all of the "User Types..." settings in the Fonts and Colors section of Tools > Options were missing. Deleting the registry key restored them. They attained their default values which gave me the syntax highlighting colors I was looking for.

This was the only solution that worked for me. Switching themes, resetting my personalized settings to defaults, running devenv.exe with various command line switches to setup/reset Visual Studio did not work.

I also created the following bug report with Microsoft on their Connect site:

http://connect.microsoft.com/VisualStudio/feedback/details/810985/incorrect-syntax-highlighting-for-c-types.

查看更多
成全新的幸福
4楼-- · 2019-01-05 10:57

1 - delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0 2 - open vs console as administrator, and run: devenv.exe /setup devenv.exe /ResetSettings1 - delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0 2 - open vs console as administrator, and run: devenv.exe /setup devenv.exe /ResetSettings

This is what helped me...

查看更多
虎瘦雄心在
5楼-- · 2019-01-05 10:58

Found the source of the problem: If you have the "Productivity Power Tools 2012" installed,

you should go to Tools -> Options -> Productivity Power Tools and turn off the "Colorized Parameter Help" option.

This fixed the syntax highlight problem.

查看更多
放我归山
6楼-- · 2019-01-05 10:58

I already had VS 2012 Pro installed on my machine. I then installed VS 2013 Pro and started facing this color issue. I then deleted the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors key and opened VS 2013. This approach solved my issue and the colors were back.

查看更多
Juvenile、少年°
7楼-- · 2019-01-05 11:02
  1. delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0
  2. open vs console as administrator, and run:

    devenv.exe /setup
    devenv.exe /ResetSettings
    

This solution worked for me. Thanks alot Gaz Winter

查看更多
登录 后发表回答