For the past couple of days, Nick and I have been working on tweaking VS.NET to add extra functionality. Nick is currently working on adding more NAnt support to the IDE, while I started to mess around with our dear old friend, the .config file.
After lunch today, I was wondering how hard it would be to add intellisense support to any .config file through VS.NET (a feature that is long awaited in VS2005). I gots to thinking about it and then I realized that there are two requirements:
- The full CLR config file schema
- The location of all .config file templates for VS.NET
The first task was easy since I know the settings schema can be found on MSDN. However, I didn't want to go through all the trouble of writing it to a valid XML schema. So I asked Google for some help. I found this article on Rad Software's site that had the full schema available for me to download. Score!! I took the file and made some minor changes to it and placed it in the folder
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml
The second task was a bit of a pain since I had to make changes to all project templates for all languages (C#,J#,VB.NET,VC++). To find out the location of all .config files that are 'generated' by VS.NET, I did a quick windows search for *.config for the C:\Program Files\Microsoft Visual Studio .NET 2003 folder only. Then I looked at the path of the files to see if it was part of a VS.NET wizard. For example, the web.config for a new ASP.NET Web Application project can be fould at this location:
C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpWebAppWiz\Templates\1033.
After finding the .config file, I needed to link the file along with the schema to get intellisense. To do so, you need to change <configuration>tag in the template file to read
<congiruation xmlns="http://schemas.microsoft.com/CLRConfig">
To test, create a new web project and edit the web.config, you will see the intellisense at work!
When you are ready to debug/deploy/run your application you need to remove the xmlns="blah" from your file otherwise your application will not run. Sorry, but it's how the CLR is configured to run!