iisTypeGen generates a strongly typed class from the IIS7 schema.
 
Usage:
    iisTypeGen [schema path] [section name] [output dir] [language]

Args:
    [schema path]: Schema xml file or directory.
    If a directory is specified, the sections will be merged.

    [section name]: The schema section name to generate.
    To generate all sections, specify "*".

    [output dir]: Generated code files will be created in dir.
    - Optional arg, default will be current directory.

    [language]: The specified language to generate the code in.
    - Optional arg, but must be "C#" or "VB". Default is C#.

Examples:
    iisTypeGen C:\schemaDir system.webServer/httpErrors C:\genCode C#
    iisTypeGen IIS_schema.xml * C:\genCode VB
                

 
This utility was based on a tool that Kanwaljeet Singla blogged about a while back. I found that I wanted a little more control over what the generated types looked like, so I decided to leverage Kanwal's schema parser (slightly modified) and wrap my head around System.CodeDom to see what I could come up with.
 
Benefits:
  • Create types in C# or VB. NET
  • Generate "merged" types based on multiple schema files containing the same section path
  • Automatically defined regions for sections, collections, elements, and enums
  • Eliminates unnecessary duplicate types within the namespace
Examples generated from the system.webServer/httpErrors section of the Beta 3 schema
C# - SystemWebServer.HttpErrors.cs
VB .NET - SystemWebServer.HttpErrors.vb
 
Download iisTypeGen.zip (16kb)
 

 
If anybody runs into any nasty bugs or has any other feedback, feel free to drop me a line
 
Michael Ayling - 2007