如何在使用 XSD.exe 生成的 C# 类中包含 xsd:documentation?

发布于 2024-08-20 15:03:46 字数 615 浏览 3 评论 0原文

我正在使用 xsd.exe 生成来自 xsd 文件集合的 C# 类。 xsd 文件使用 标记来包含有用的描述。示例:

<xsd:complexType name="AddressType">
    <xsd:annotation>
        <xsd:documentation>A formatted or free form address and its intended use.</xsd:documentation>
    </xsd:annotation>

不幸的是,所有这些都在生成的 C# 类中丢失了。有趣的是,每个类都附加了一个空的remarks文档标签。

/// <remarks/>

如何将此文档包含在生成的 C# 类中(in 或文档标记)?

I am using xsd.exe to generate a C# class from a collection of xsd files. The xsd file makes use of the <xsd:documentation> tag to include useful descriptions. Example:

<xsd:complexType name="AddressType">
    <xsd:annotation>
        <xsd:documentation>A formatted or free form address and its intended use.</xsd:documentation>
    </xsd:annotation>

Unfortunately all of this is lost in the generated C# class. Interestingly each class has an empty remarks documentation tag attached to it.

/// <remarks/>

How can I include this documentation in the generated C# class (either in or documentation tags)?

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

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

发布评论

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

评论(1

梦冥 2024-08-27 15:03:46

xsd.exe 基于 Codedom。

您可以反汇编 xsd.exe,然后在其中添加功能并重新编译。
代码相当简单。

我对其进行了修改,以便在生成代码时跳过 xsd 中的一些名称空间。[否则,如果我在另外 2 个 xsd 中包含 common.xsd,则该类将生成两次。]

当然,我可以访问正确的源代码本身 [我是一名开发人员Microsoft],但是使用反汇编代码,该过程也应该很简单。

xsd.exe is based on Codedom.

You could disassemble xsd.exe, and add the functionality there and recompile.
The code is reasonably simple.

I had modified it to skip some namespaces from xsd while generating code.[Otherwise If I include a common.xsd in 2 other xsds the class was getting generated twice.]

Granted, I had access to source proper itself [I was a developer at Microsoft], but the process should be simple with diassembled code as well.

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