Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 syntax coloring for C# types [duplicate]

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?

like image 927
Jedidja Avatar asked Jun 10 '12 16:06

Jedidja


4 Answers

Here is a simple solution. Go to the directory where devenv is (for 2012 RC), and type devenv.exe /setup. It will fix your problem.

devenv.exe is usually in something like C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE.

Edit: It has been suggested that you do this from the Visual Studio command prompt (Start>Microsoft Visual Studio>Tools>Visual Studio Command Prompt), and/or make sure your command prompt has administrator permissions.

Note for others: This has a very good chance of working for many other versions of Visual Studio, including 2008, 2010, 11 beta, ...

like image 52
GregRos Avatar answered Oct 04 '22 07:10

GregRos


My problem was limited to having the "DateTime" type not showing up in light blue like other class names. I fixed it by simply switching back-and-forth between VS Themes. Discovered by accident. Much quicker than reset settings or repair install...

VS menu Tools -> Change Color Theme

like image 38
Marc-André Avatar answered Oct 04 '22 08:10

Marc-André


This is what worked for me:

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 will reset all your environment settings.

like image 34
Leonardo Herrero Avatar answered Oct 04 '22 06:10

Leonardo Herrero


If none of the above work for you, delete all GUID-named folders under this registry key (make sure your Visual Studio instance is closed):

If you're using Visual Studio 2012: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\FontAndColors

If you're using Visual Studio 2013: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors

If you're using Visual Studio 2015: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\FontAndColors

Restart Visual Studio, and you should see a few various "User Types" to configure. You can then import your Fonts and Colors that you backed-up, and everything will be good to go. This may also work for previous and future versions of VS, but I have not tested.

Disclaimer: Make sure you export/backup your current Fonts and Colors settings before making these registry adjustments. I cannot be held responsible for you losing your configs :)

like image 39
Matt Avatar answered Oct 04 '22 07:10

Matt