Share on:

MSBuildSchemaGen is no longer available for download. This page is kept for posterity.

MSBuildSchemaGen was a tool that generated MSBuild XSD schema files for custom MSBuild tasks, which allowed the Visual Studio editor to provide tooltips for your custom tasks when you are writing MSBuild scripts.

MSBuildSchemaGen generated its schemas in such a way that it was able to handle tasks that derive from base Task classes, including abstract classes, and could also restrict inputs to parameters that required it by binding them to enumerations.

In addition to schemas, MSBuildSchemaGen also produced a tasks reference file for your assembly, which saved you having to remember the UsingTask statements for your tasks.


The original post covers a bit more about the tool.

Example Output

 2    xmlns:msb="" 
 3    elementFormDefault="qualified" 
 4    targetNamespace="" 
 5    xmlns:xs="">
 6  <xs:include schemaLocation="MSBuild\Microsoft.Build.Commontypes.xsd" />
 7  <xs:simpleType name="ColoringType">
 8    <xs:union memberTypes="msb:non_empty_string">
 9      <xs:simpleType>
10        <xs:restriction base="xs:string">
11          <xs:enumeration value="Blue">
12            <xs:annotation>
13              <xs:documentation>The blue colouring.</xs:documentation>
14            </xs:annotation>
15          </xs:enumeration>
16          <xs:enumeration value="Red">
17            <xs:annotation>
18              <xs:documentation>The red colouring.</xs:documentation>
19            </xs:annotation>
20          </xs:enumeration>
21        </xs:restriction>
22      </xs:simpleType>
23    </xs:union>
24  </xs:simpleType>
25  <xs:complexType name="TestTaskType">
26    <xs:complexContent mixed="false">
27      <xs:extension base="msb:TaskType">
28        <xs:attribute name="Name" type="msb:non_empty_string" use="required">
29          <xs:annotation>
30            <xs:documentation>Gets or sets the name of the item.</xs:documentation>
31          </xs:annotation>
32        </xs:attribute>
33        <xs:attribute name="Color" type="msb:ColoringType" use="optional">
34          <xs:annotation>
35            <xs:documentation>[Optional] Gets or sets the color.</xs:documentation>
36          </xs:annotation>
37        </xs:attribute>
38        <xs:attribute name="DisplayType" type="xs:string" use="optional">
39          <xs:annotation>
40            <xs:documentation>[Optional] [Obsolete] Gets or sets the display type.</xs:documentation>
41          </xs:annotation>
42        </xs:attribute>
43        <xs:attribute name="Result" type="xs:string" use="optional">
44          <xs:annotation>
45            <xs:documentation>[Optional] [Output] Gets the result.</xs:documentation>
46          </xs:annotation>
47        </xs:attribute>
48      </xs:extension>
49    </xs:complexContent>
50  </xs:complexType>
51  <xs:element name="TestTask" substitutionGroup="msb:Task" type="msb:TestTaskType">
52    <xs:annotation>
53      <xs:documentation>Test task 1.</xs:documentation>
54 </xs:annotation>
55 </xs:element>