diff --git a/XmlSchemaClassGenerator.Console/Program.cs b/XmlSchemaClassGenerator.Console/Program.cs index e0b8c0ee..a9e4121c 100644 --- a/XmlSchemaClassGenerator.Console/Program.cs +++ b/XmlSchemaClassGenerator.Console/Program.cs @@ -139,7 +139,7 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l { "cc|complexTypesForCollections", "generate complex types for collections (default is true)", v => generateComplexTypesForCollections = v != null }, { "s|useShouldSerialize", "use ShouldSerialize pattern instead of Specified pattern (default is false)", v => useShouldSerialize = v != null }, { "sf|separateFiles", "generate a separate file for each class (default is false)", v => separateClasses = v != null }, - { "nh|namespaceHierarchy", "generate a separate folder for namespace hierarchy. Accepted only if \"separateFiles\" is true (default is false)", v=> separateNamespaceHierarchy = v != null }, + { "nh|namespaceHierarchy", "generate a separate folder for namespace hierarchy. Implies \"separateFiles\" if true (default is false)", v=> separateNamespaceHierarchy = v != null }, { "sg|separateSubstitutes", "generate a separate property for each element of a substitution group (default is false)", v => separateSubstitutes = v != null }, { "dnfin|doNotForceIsNullable", "do not force generator to emit IsNullable = true in XmlElement annotation for nillable elements when element is nullable (minOccurs < 1 or parent element is choice) (default is false)", v => doNotForceIsNullable = v != null }, { "cn|compactTypeNames", "use type names without namespace qualifier for types in the using list (default is false)", v => compactTypeNames = v != null }, diff --git a/XmlSchemaClassGenerator/FileOutputWriter.cs b/XmlSchemaClassGenerator/FileOutputWriter.cs index 337ff0d6..2d155247 100644 --- a/XmlSchemaClassGenerator/FileOutputWriter.cs +++ b/XmlSchemaClassGenerator/FileOutputWriter.cs @@ -33,7 +33,7 @@ public override void Write(CodeNamespace cn) var cu = new CodeCompileUnit(); cu.Namespaces.Add(cn); - if (Configuration?.SeparateClasses == true) + if (Configuration?.SeparateClasses == true || Configuration?.SeparateNamespaceHierarchy == true) { WriteSeparateFiles(cn); } @@ -71,7 +71,7 @@ private void WriteSeparateFiles(CodeNamespace cn) var validatedNamespaceName = ValidateName(cn.Name); var namespacePath = validatedNamespaceName; - + if (Configuration?.SeparateNamespaceHierarchy == true) { namespacePath = Path.Combine(validatedNamespaceName.Split('.'));