← All articles

Syntax Highlighting for .build and .msbuild

A simple Visual Studio trick I wish I'd known sooner: map .build and .msbuild file extensions to the XML editor to get proper syntax highlighting.

Donn Felker

Donn Felker

2007.12.01 · 1 min read

Sara Ford posted a blog entry (which I got from the VS2008 Tip of the Day Gadget on Vista) which made me slap my forehead and say “… #$@#! why didn’t I find that before.”

Pretty much, you can show syntax highlighting for custom file extensions.

When I make build files, I like to name them .build or .msbuild (depends on whether its a NAnt script or MSBuild script).

Previously, I would edit my build script in Notepad++ and set the style to XML for syntax highlighting. It worked well, but I hated having to leave Visual Studio to edit my build file with nice pretty colors.

Now, with this tip (see the link above) I have set my build file extensions to open with the XML Editor.

Here’s what I did:

buildFileSyntaxColoring

Now when I open the build files I get the pretty colors.

Oh how the simple things impress me at times. I just wish I knew about this before. It just goes to show you that Visual Studio is a very in depth program.

Thanks for the tip Sara!

Donn Felker

Written by Donn Felker

I've spent 25+ years shipping software, writing books, and running my own companies. I write about thinking clearly, working for yourself, and doing real work while AI rewrites the rules. New essays land here every week.

Get the newsletter

Keep reading