有没有办法让XSD.EXE生成班级"内部"范围? [英] Is there a way to get xsd.exe to generate classes with "internal" scope?

查看:101
本文介绍了有没有办法让XSD.EXE生成班级"内部"范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一些XSD生成的类的DLL。不幸的是,XSD.EXE使这些类公开,这将导致缺少XML注释的公共可见的类型或成员XYZ的警告。另外,我宁愿不从我的DLL公开这些类。有什么办法,总之手动编辑生成的.cs,使这些类的的内部的?

I've got a DLL that contains some XSD-generated classes. Unfortunately, XSD.exe makes those classes public, which results in "Missing XML comment for publicly visible type or member XYZ" warnings. Plus, I'd rather not expose those classes from my DLL. Is there a way, short of manually editing the generated .cs, to make those classes internal?

推荐答案

这是一个非常简短的回答可能扩大到一本书。

This is a very short answer which could be expanded to a book.

没有,XSD.EXE不能做你想要的。

No, xsd.exe can't do what you want.

不过,您可以使用本文访问的Xml codeExporter 类,它是产生code从XML架构框架的一部分。一旦做到这一点,你有 codeDOM 所生成的code在内存中。你可以通过所有的类命名空间中的循环,并将其设置为内部。

However you can use the techniques described in this article to access the XmlCodeExporter class which is part of the framework that generates code from XML schemas. Once this is done, you have a copy of the CodeDOM for the generated code in memory. you can iterate through all the classes in the namespace and set them to internal.

这可能是需要努力消除这一警告是比你更想。

It may be that the effort required to remove this one warning is more than you would like.

另一种方式来删除警告是生成code为其中的XML文档被关闭的程序集(毕竟谁需要文档的生成code?)

Another way to remove the warning is to generate the code in an assembly for which the XML docs are turned off (after all who needs docs for generated code?)

这篇关于有没有办法让XSD.EXE生成班级"内部"范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆