获取所需目录的说明

发布于 2024-08-01 13:03:54 字数 550 浏览 2 评论 0原文

在我的基于 Windows 的项目集中,XML 文件位于“c:\TestProj\XmlSource”。

我的任务是以编程方式为这些 xml 文件创建架构文件。

我正在执行如下代码:

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

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

代码工作正常并且生成了 XSD。问题是,XSD 是在 Debug 文件夹中生成的。 我想在 XSD 文件夹(c:\TestProj\XmlSource\XSD)中创建这些 XSD。如何强制 XSD.exe 将输出生成到所需的文件夹。 我对处理 outputDir 开关有点困惑。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

动次打次papapa 2024-08-08 13:03:55

查看xsd.exe的/out参数

Check out the /out parameter of xsd.exe

内心激荡 2024-08-08 13:03:54
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"); 
}
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"); 
}
九命猫 2024-08-08 13:03:54

尝试

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

Try

foreach (string foundName in System.IO.Directory.GetFiles(directoryName)) 
{ 
   Process.Start(@"c:\TestProj\xsd.exe", string.Concat(Path.Combine(directoryName, foundName), " /out:OutputFolder"); 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文