Wednesday, September 13, 2006

.NET Remoting config schema

I've recently been working with .NET Remoting; writing a small distrubuted framework for sending "work packets" across a set of machines. I'm trying to be a good developer by ensuring all compile and schema warnings are fixed. However, no matter what I did, my App.config file was issues warning after warning for misconfigured elements I knew to be correct. Moreover, Visual Studio IntelliSense did not work with remoting application entries within <system.runtime.remoting/>.

This annoyed me somewhat, so I decided to investigate.

I first checked the properties for App.config to see what schema was used. Config files follow the DotNetConfig.xsd schema which, for me, sits in the default installation folder (C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas). I searched for the remoting definition and found the elements and attributes of system.runtime.remoting were missing. A quick Google revealed this was happening to a lot of people. Basically, the schema shipped with Visual Studio is incomplete.

In order to fix this, and being lazy and not knowing too much about XML Schemas, I constructed a sample .xml file using all the elements defined in the Microsoft schema reference ( Then, using the XML->Create Schema feature of Visual Studio, I generated the relevant schema definitions. I then added attribute information for each element defined in the schema reference to this output. This produced a complete (to the best of my knowledge) definition of system.runtime.remoting. I then replaced the element definition within DotNetConfig.xsd (being careful to copy the vs:help info into the element definition). NOTE: make a backup copy of your existing DontNetConfig.xsd first.

Anyway, after all this hoop jumping, I now have a working system.runtime.remoting schema that removes all the warnings. Intellisense also works.

Here is a copy of the fixed DotNetConfig.xsd. Hopefully others will find this useful.