- Open the Visual Studio .NET command prompt and browse to the directory where your XSD file exists.
- Type the following at the prompt: xsd.exe SchemaName.xsd /DataSet /language:CS, where SchemaName.xsd is the name of your XSD file. In this example, the command line looks like this: xsd.exe Customers.xsd /DataSet /language:CS. For Visual Basic .NET, use /language:VB.
- Look for your generated class file. In this sample, a file named Customers.cs will be created.
There are several options and flags for the xsd.exe tool, but the important flag for creating your strongly typed DataSet object is the /DataSet flag. This tells the tool to parse through the XSD file and autogenerate a strongly typed DataSet object for you. A view of the command line looks like this:
C:\>xsd.exe Customers.xsd /DataSet /language:CS
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002.
All rights reserved.
Writing file 'C:\Customers.cs'.