Visual Studio Syntax Highlighting for C# Files

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Environment: Visual Studio and C#

Here are the instructions necessary to have Visual Studio syntax-highlight your C# files.

  1. Locate the following key in your registry (using regedit or any other registry editor):

    HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs/Language Settings\C/C++\FileExtensions

    This value will contain a value like the following:

    cpp;cxx;c;h;hxx;hpp;inl;tlh;tli;rc;rc2

    Simply add the .cs extension to the end as in this example:

    cpp;cxx;c;h;hxx;hpp;inl;tlh;tli;rc;rc2;cs

  2. Download the usertype.dat file (at the bottom of this document)
    and copy it to the same directory as msdev.exe
    (Visual Studio editor) (By default this will be
    c:\program files\microsoft visual studio\common\msdev98\bin). This file contains all the C# keywords

Downloads

Download (zipped) usertype.dat file (containing C# keywords) – 1 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read