如何生成.NET类从WSDL和XSD评论 [英] How to generate .NET classes with comments from WSDL and XSD

查看:448
本文介绍了如何生成.NET类从WSDL和XSD评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一些的XSD和WSDL。我想从这些网页C#code。我用svcutil.exe的,但它不会生成的XSD注释XML的注释:

There are some XSDs and WSDLs. I want to generate C# code from them. I used svcutil.exe, but it does not generate XML-comments from XSDs annotations:

<annotation>
    <documentation>VERY USEFULL DOCUMENTATION</documentation>
</annotation>

我想这里面生成的文件:

I want this inside generated file:

public class SomeData
{
    /// <summary>
    /// VERY USEFULL DOCUMENTATION
    /// </summary>
    public string SomeField
    {...}
}

另一个问题:如何强制svcutil.exe的生成每个类一个文件? (我知道我可以使用重构从ReSharper的移动类到单独的文件,但我不喜欢这个解决方案)

Another question: how to force svcutil.exe to generate one file per class? (I know that I can use refactor from Resharper to move classes to separate files, but I don't like this solution)

那么如何生成多个文件(每​​个类一个文件)从的XSD和WSDL XML的注释

So how to generate multiple files (one file per class) with XML-comments from XSDs and WSDLs

推荐答案

您可能能够使用WCFExtras + HTTP://wcfextrasplus.$c$cplex.com/

You might be able to use the WCFExtras+ http://wcfextrasplus.codeplex.com/.


  1. 请WCFExtras.dll可见svcutil.exe的(如通过将它们放在同一个目录下)

  2. 添加此部分的客户端应用程序的一个新的配置文件中的app.config或地点和调用与/ svcutilConfig开关SvcUtil工具

  1. Make WCFExtras.dll visible to svcutil.exe (such as by putting them in the same directory)
  2. add this section to the app.config of the client app, or place in a new config file and invoke svcutil with the /svcutilConfig switch

 <configuration>
  <system.serviceModel>
    <client>
      <metadata>
        <wsdlImporters>
          <extension type="WCFExtras.Wsdl.Documentation.XmlCommentsImporter, WCFExtras" />
        </wsdlImporters>
      </metadata>
    </client>
  </system.serviceModel>
</configuration>


例如命令行,其中configfile.xml是配置文件上面:
svcutil.exe的[服务URL] / svcutilConfig:[路径configfile.xml]

example command line, where configfile.xml is the config file above: SvcUtil.exe [service url] /svcutilConfig:[path to configfile.xml]

这篇关于如何生成.NET类从WSDL和XSD评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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