xsd.exe 输出文件名

发布于 2024-07-21 05:18:39 字数 73 浏览 3 评论 0原文

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

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

Is there a way to control the output filename from xsd.exe?

My specific issue is that if an imported xsd is referenced this is added to the filename.

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

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

发布评论

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

评论(4

謸气贵蔟 2024-07-28 05:18:39

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

xsd.exe schema1.xsd schema2.xsd .\schema3.xsd

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

注意:这是一个 hack,但到目前为止(VS 2010)它是有效的。

This link suggests another alternative ... using a path character in specifying the input schemas resets the generated file name. So if you use the following you will be able to control your output file name.

xsd.exe schema1.xsd schema2.xsd .\schema3.xsd

Will force xsd.exe to generate the schema3.cs file.

Note: It's a hack but up to now (VS 2010) it works.

厌味 2024-07-28 05:18:39

添加到 AxelEckenberger 的答案中,如果您定期执行此操作(即在批处理脚本中),则黑客的改进会非常轻微。 使用您想要使用的输出名称创建一个空架构文件

Output.xsd

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" />

然后您不需要重命名输出

xsd.exe schema1.xsd schema2.xsd schema3.xsd .\Output.xsd

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

To add to AxelEckenberger's answer there is a very slight improvement on the hack if you are doing this regularly (i.e in a batch script). Create an empty schema file with the output name that you want to use

Output.xsd

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" />

Then you don't need to rename the output

xsd.exe schema1.xsd schema2.xsd schema3.xsd .\Output.xsd

Now the output file will be named Output.cs.

吻安 2024-07-28 05:18:39

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

也就是说,将其包装在批处理作业中很简单,这将满足您的要求。

rename output.cs yourname.cs

xsd.exe will automatically choose the output name of the file based on the input file name. You can only choose what directory to output it to with the /o switch.

That said, it's trivial to wrap this in a batch job, that would do what you want.

rename output.cs yourname.cs
傲影 2024-07-28 05:18:39

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

否。仅输出文件夹:

/o[ut]:directoryName

来自此处

Update: Please see @Obalix's answer.

No. Only the output folder:

/o[ut]:directoryName

From here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文