Is it possible to specify different C# namespaces for different groups of definitions?

Nov 2, 2011 at 9:46 PM

I have 3 xsd files:

  • A.xsd
  • B.xsd
  • Common.xsd

Both A.xsd and B.xsd include Common.xsd for common type definitions.

In order to use Xsd2Code to generate C# classes for the xsd files, I created a sample parent xsd like the following and right click in Visual Studio to run Xsd2Code

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="" ...>
  <xs:include schemaLocation="A.xsd"/>
  <xs:include schemaLocation="B.xsd"/>

I would like to have all types definied in A.xsd to be in C# namespace Application.CustomA, all types in B.xsd to be in Application.CustomB, while all types in Common.xsd in Application.Common.  Is there any xsd definition I can add to A.xsd, B.xsd and Common.xsd to archieve this?