Using XSD with Microsoft Visual Studio

From Code Synthesis Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 11:55, 3 February 2008
Boris (Talk | contribs)
(start the page)
← Previous diff
Revision as of 12:36, 3 February 2008
Boris (Talk | contribs)

Next diff →
Line 1: Line 1:
'''Note: this page is a work in progress and is based on the upcoming XSD 3.1.0''' '''Note: this page is a work in progress and is based on the upcoming XSD 3.1.0'''
-This page describes various ways of integrating the XSD compiler with Microsoft Visual Studio ISE as well as other Visual Studio-specific topics.+This page describes various ways of integrating the XSD compiler with the Microsoft Visual Studio IDE as well as other Visual Studio-specific topics.
== Visual Studio .NET 2003 (7.1) == == Visual Studio .NET 2003 (7.1) ==
 +
 +A common way of integrating the XSD compilation step in Visual Studio (VS) 7.1 is with the custom build steps. With this method you add the schema file to your project and specify the command line as well as the output files. When the project is built, VS IDE will check if the output files do not exist or out-of-date compared to the schema file and will execute the specified command line in order to regenerate them. The following step-by-step instructions show how to acomplish this:
 +
 +# Add the schema file (e.g., hello.xsd) to your project ("Project"->"Add Existing Item" menu action). At this point VS assumes that you are going to use Microsoft xsd.exe tool and will try to compile the schema which may fail. This is ok. You may also find that additional files (e.g., hello.h) were added under the schema item. You can remove all of them.
 +# Open the Properties dialog for the schema file (select the schema file in the Solution Explorer and choose "Project"->"Properties" menu action).
 +# In the Properties dialog select the General tab and choose "Custom Build Tool" for the Tool field. Then press the Apply button.
 +# In the same Properties dialog select the "Custom Build Step" tab. There you will have the "Command Line", "Description", "Outputs", and "Additional Dependecies" fields. Fill them depending on how you want to compile your schema, for example:
 +# Press the Ok button to close the Properties dialog.
 +# Compile the schema by select the schema file in the Solution Explorer and choosing "Build"->"Compile" menu action. This will result in the output files (e.g., hello.hxx and hello.cxx) being created.
 +# Add the output files (e.g., hello.hxx and hello.cxx) to the project ("Project"->"Add Existing Item" menu action).
 +
== Visual Studio 2005 (8.0) and 2008 (9.0) == == Visual Studio 2005 (8.0) and 2008 (9.0) ==

Revision as of 12:36, 3 February 2008

Note: this page is a work in progress and is based on the upcoming XSD 3.1.0

This page describes various ways of integrating the XSD compiler with the Microsoft Visual Studio IDE as well as other Visual Studio-specific topics.

Visual Studio .NET 2003 (7.1)

A common way of integrating the XSD compilation step in Visual Studio (VS) 7.1 is with the custom build steps. With this method you add the schema file to your project and specify the command line as well as the output files. When the project is built, VS IDE will check if the output files do not exist or out-of-date compared to the schema file and will execute the specified command line in order to regenerate them. The following step-by-step instructions show how to acomplish this:

  1. Add the schema file (e.g., hello.xsd) to your project ("Project"->"Add Existing Item" menu action). At this point VS assumes that you are going to use Microsoft xsd.exe tool and will try to compile the schema which may fail. This is ok. You may also find that additional files (e.g., hello.h) were added under the schema item. You can remove all of them.
  2. Open the Properties dialog for the schema file (select the schema file in the Solution Explorer and choose "Project"->"Properties" menu action).
  3. In the Properties dialog select the General tab and choose "Custom Build Tool" for the Tool field. Then press the Apply button.
  4. In the same Properties dialog select the "Custom Build Step" tab. There you will have the "Command Line", "Description", "Outputs", and "Additional Dependecies" fields. Fill them depending on how you want to compile your schema, for example:
  5. Press the Ok button to close the Properties dialog.
  6. Compile the schema by select the schema file in the Solution Explorer and choosing "Build"->"Compile" menu action. This will result in the output files (e.g., hello.hxx and hello.cxx) being created.
  7. Add the output files (e.g., hello.hxx and hello.cxx) to the project ("Project"->"Add Existing Item" menu action).


Visual Studio 2005 (8.0) and 2008 (9.0)

Personal tools