title: c# xml schema validation only works on local computer but not on server
body: <p>The following XML validation only works on my local computer. When I run the same validation on our test server I get the error message: "simpleType 'schemaversion' has already been declared". Why?</p>
  
  <pre><code>XmlSchema schemaSimpleTypes = GetXmlSchemaFromContractAssembly(assemblyContract, "SimpleTypes");
  XmlSchema schemaCommonTypes = GetXmlSchemaFromContractAssembly(assemblyContract, "CommonTypes");
  XmlSchema schemaMessageType = GetXmlSchemaFromContractAssembly(assemblyContract, messageType);
  
  // Set the validation settings
  XmlReaderSettings settings = new XmlReaderSettings();
  settings.ValidationType = ValidationType.Schema;
  settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
  settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
  settings.Schemas.Add(schemaSimpleTypes);
  settings.Schemas.Add(schemaCommonTypes);
  settings.Schemas.Add(schemaMessageType);
  
  // Create the XmlReader object
  XmlReader reader = XmlReader.Create(DataConversion.ConvertUtf8StringToStream(xmlDoc.OuterXml), settings);
  
  // Parse the file. 
  while (reader.Read())
  {
      // go through XML, validating against XSD
      // exceptions are passed to the calling method
  };
  
  reader.Close();
  </code></pre>
  
  <p>When I perform the validation without "schemaSimpleTypes" and "schemaCommonTypes", then it does work on the server but not on the local computer and I get following error on the local comupter : "The type 'schemaversion' is not a simple type or has not been declared . "
  Here's the code:</p>
  
  <pre><code>XmlSchema schemaSimpleTypes = GetXmlSchemaFromContractAssembly(assemblyContract, "SimpleTypes");
  XmlSchema schemaCommonTypes = GetXmlSchemaFromContractAssembly(assemblyContract, "CommonTypes");
  XmlSchema schemaMessageType = GetXmlSchemaFromContractAssembly(assemblyContract, messageType);
  
  // Set the validation settings
  XmlReaderSettings settings = new XmlReaderSettings();
  settings.ValidationType = ValidationType.Schema;
  settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
  settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
  //settings.Schemas.Add(schemaSimpleTypes);
  //settings.Schemas.Add(schemaCommonTypes);
  settings.Schemas.Add(schemaMessageType);
  
  // Create the XmlReader object
  XmlReader reader = XmlReader.Create(DataConversion.ConvertUtf8StringToStream(xmlDoc.OuterXml), settings);
  
  // Parse the file. 
  while (reader.Read())
  {
     // go through XML, validating against XSD
     // exceptions are passed to the calling method
  };
  
  reader.Close();
  </code></pre>
  
  <p>What is the problem here?</p>