xsd.exe输出文件名

NJE*_*NJE 28 .net xsd xsd.exe

有没有办法从xsd.exe控制输出文件名?

我的具体问题是,如果引用了导入的xsd,则会将其添加到文件名中.

Axe*_*ger 44

此链接建议另一种方法...在指定输入模式时使用路径字符会重置生成的文件名.因此,如果您使用以下内容,您将能够控制输出文件名.

xsd.exe schema1.xsd schema2.xsd .\schema3.xsd
Run Code Online (Sandbox Code Playgroud)

将强制xsd.exe生成schema3.cs文件.

注意:这是一个黑客,但到目前为止(VS 2010)它的工作原理.

  • +1,正是我需要的!(即使在参数文件中指定的模式时也能工作) (3认同)
  • 请记住,必须在最后一个文件中使用".\".如果需要,请在命令中重新排序输入文件名. (2认同)
  • 或者,使用 xsd.exe /p:parameters.xml .\schema3.xsd 来处理那些需要包含数百个架构文件的令人愉快的情况 (2认同)

Eoi*_*ell 11

xsd.exe将根据输入文件名自动选择文件的输出名称.您只能使用/ o开关选择将其输出到的目录.

也就是说,将它包装在一个批处理作业中是微不足道的,这可以做你想要的.

rename output.cs yourname.cs
Run Code Online (Sandbox Code Playgroud)


bri*_*ler 11

要添加到AxelEckenberger的答案中,如果您经常这样做(即在批处理脚本中),那么黑客攻击会有很小的改进.使用要使用的输出名称创建一个空模式文件

Output.xsd

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" />
Run Code Online (Sandbox Code Playgroud)

然后您不需要重命名输出

xsd.exe schema1.xsd schema2.xsd schema3.xsd .\Output.xsd
Run Code Online (Sandbox Code Playgroud)

现在输出文件将被命名Output.cs.


Mit*_*eat 7

更新:请参阅@ Obalix的回答.

不.只有输出文件夹:

/o[ut]:directoryName
Run Code Online (Sandbox Code Playgroud)

这里开始.