Notepad++ Tip: Syntax Highlighting for ASP.NET Files
Notepad++ has a spot in my toolbox mostly because I like it as a lightweight viewer/editor for one-off situations where I really don't feel like loading up Visual Studio just to take a quick peek at a file.
When I first started using Notepad++, one of my common usage patterns was to take a quick look at a file that was part of some solution that I did not currently have open in a Visual Studio instance. I'd just find the file in Windows Explorer, right-click on it, and select "Edit with Notepad++" (which is a context menu addition the Notepad++ installer makes that you'll actually find handy rather than annoying). No long load time, no fuss.
But one of the things I quickly missed that I would have gotten in Visual Studio was syntax highlighting. For example, if I opened a Web.config file in Notepad++, I wouldn't get any syntax highlighting, because Notepad++ didn't know that *.config files are really XML.
The solution to my problem lied in a very obscure Notepad++ setting that took me a lot of digging to find.
Here's what you do:
- On the Notepad++ menu bar, click "Settings" -> "Styler Configurator..."
- Under "Language", select "XML"
That's it! Now when you view config files, ASP.NET pages, user controls, or master pages in Notepad++, you'll get syntax highlighting.