views:

146

answers:

2

Can Visual Studio 2010 be configured to do syntax highlighting on ".inc" files? We have numerous large projects with tons of these ".inc" files (asp files) and so changing the file extension to ".asp" is not an option. All I want Visual Studio 2010 to do is treat these ".inc" files just like ".asp" files when it comes to syntax highlighting.

I've tried "Open With..." and selected the HTML Editor, which is the ".asp" default, but that did not work. I tried about every other editor in the list and none of them worked.

I know Notepad++ (among others) can do this, but I would prefer this be done in Visual Studio 2010 - using another IDE or text editor is not the answer I'm looking for here.

Many many thanks to anyone who knows how to configure VS 2010 to do this, I've wasted soooo much time looking for a way to do this. Even registry hacks are welcome.

Thanks for any feedback you can provide!

+1  A: 

Use the File Extension, Text Editor, Options Dialog Box. http://msdn.microsoft.com/en-us/library/4k7w5e5s.aspx

-update-

I see the same behavior :-( Will let you know if I find anything.

As a workaround, could you rename all your .inc files to .asp?

This has the added advantage that if a request is made for the inc file directly (highly unlikely but possible; and assuming you have the incs in the web directory), your code will be exposed unlike .asp where it is processed and rendered.

Raj Kaimal
I appreciate the quick response Raj, however, this solution doesn't work like I wanted.When I put in ".inc" and have it open with the HTML Editor, which is the ".asp" file default, it will highlight the code delimiters and html, but nothing between the code delimiters is highlighted - keywords (Dim, If, Then, Else, etc), strings, etc.I know it seems like it should work, but if you test it for yourself you'll see it does not syntax highlight exactly like asp files - it's like the HTML Editor is hardcoded to treat asp files differently.
MarkMRM
A: 

In Visual Studio...go to Options -> Text Editor -> File Extension. Type in 'inc' as extension and editor as 'Web Form Editor'. You may need to close then re-open your currently open .Inc pages...Hope this helps

Antonio Marasco