Friday, 5 April 2013

SSDT syntax highlighting disappeared. How I fixed it.

I recently struggled with a problem where I seemed to lose the syntax highlighting in Visual Studio 2012 for SSDT projects.  Took me a while to stumble onto a solution after multiple reinstalls and almost giving up to rebuild the PC (I like syntax highlighting)

The tldr solution is:
  • Open a Visual Studio Command Prompt (as administrator)
  • Run:

The problem (no pretty colours)

I'd been having an issue with my PC build where my SQL 2012 installation seems to lose some WMI settings.  I can temporarily fix that with a mofcomp command, but getting frustrated with that I decided to reinstall SQL Server 2012.  That was my first mistake.  After the reinstall of SQL Server 2012 I noticed I'd lost all the syntax highlighting for SSDT projects as per this Stack Overflow question (not mine by the way):

That article has the rather unhelpful "Hey it just fixed itself" answer.  No such luck for me.  After a general failing of my Google foo, I thought it would be just easier to reinstall Visual Studio 2012, SSDT etc.  So that's what I did.  Alas I still had no syntax highlighting.  And no options for the SQL "types" to manually update the colours.

To list all I had tried;
  • Removed and reinstalled SQL Server 2012
  • Patched SQL Server 2012 with SP1
  • Reinstalled SSDT for Visual Studio 2012
  • Removed and reinstalled Visual Studio 2012
  • Patched Visual Studio 2012 with Update 1
  • Tried an earlier version of SSDT
  • Updated SSDT (again)
All yielded no difference.

Twitter failed me too.

The solution

I had pretty much given up and decided to get the PC rebuilt.  But one last Google search yielded a couple of potential fixes that I thought I would try.  These were two further Stack Overflow articles about problems that were (at best) vaguely similar to mine:
The second one looked more promising, but infinitely more difficult for a simple DBA.  So I thought I'd give the first article a go first.

The first stack overflow article says to perform the following steps:
  • Open a Visual Studio Command Prompt (as administrator)
  • Run:
After all my reinstallations I really couldn't see this making any difference.  I was happy to be wrong!  These simple steps brought back the options to update colours for syntax highlighting.


  1. This comment has been removed by the author.

  2. Hi Kent, thanks for the trick ! I'm tearing my hair out with it ! But consider this : by Thomas J :

    "...I had fixed my syntax highlighting problem by deleting following registry key: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors\Cache. This clears the cache and my syntax highlighting for sql files is coming back ;-)..."

    Herve B.