tags:

views:

43

answers:

3

In My Windows based project set, of XML files are located at "c:\TestProj\XmlSource".

My mission is to programmatically create schema files for those xml files.

I am executing the code as follow:

string directoryName = @"c:\TestProj\XmlSource";

foreach (string foundName in System.IO.Directory.GetFiles(directoryName)) 
{ 
    Process.Start(@"c:\TestProj\xsd.exe",
                  Path.Combine(directoryName, foundName));
}

The code is working fine and the XSDs are generated.The problem is ,the XSDs are generated in Debug folder. I want to create those XSDs in XSD folder( c:\TestProj\XmlSource\XSD).How can I force the XSD.exe to produce the output to the desired folder. I am in a bit confusion to handle the outputDir switch.

A: 

Try

foreach (string foundName in System.IO.Directory.GetFiles(directoryName)) 
{ 
   Process.Start(@"c:\TestProj\xsd.exe", string.Concat(Path.Combine(directoryName, foundName), " /out:OutputFolder"); 
}
Cédric Boivin
A: 

Check out the /out parameter of xsd.exe

Teodor
A: 
string directoryName = @"c:\TestProj\XmlSource"; 

foreach (string foundName in System.IO.Directory.GetFiles(directoryName)) 
{ 
Process.Start(@"c:\TestProj\xsd.exe", Path.Combine(directoryName, foundName) + " /o:c:\TestProj\XmlSource\XSD"); 
}
chrissr