Monday, 19 January 2009

Syntax Highlighting and Intellisense for WSC Files in Visual Studio 2008

Recently I've been working on a system that makes use of custom WSC components. These components contain the usual XML Wrappings and then a large CDATA area containing the VBScript code.


What's really been bugging me is that Visual Studio was treating all the code within the CData XML Area as XML and I really want the VBScript to be all nice and highlighted and for VBScript intellisense to kick in, it really does save time. Now luckily making this happen was remarkably easy.


First within Visual Studio go to tools and options, click Show All Settings. Then open the Text Editor leaf and click on File Extension. Next add a new option for wsc files and specify that you wish it to use the Web Form Editor as it's editor. Click Add and then OK. You should now find when you next open a wsc file the XML has syntax highlighting as well as the VBScript, and intellisense works!


I hope this helps you, it certainly did me!

1 comment:

Unknown said...

I have been using this fab find for VS2008 but I have found that in VS2010 is no longer works.

I have found that if you change the Editor to the 'HTML Editor' everything comes back as expected.