How to create .NET classes with WSDL and XSD comments

There are several XSD and WSDL. I want to generate C # code. I used svcutil.exe, but it does not generate XML comments from XSD annotations:

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

I want this inline file:

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

Another question: how to make svcutil.exe generate one file for each class? (I know that I can use refactoring from Resharper to move classes to separate files, but I don't like it)

So, how to generate multiple files (one file for each class) with XML comments from XSD and WSDL

+4
source share
2 answers

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

  • Make WCFExtras.dll visible to svcutil.exe (for example, by placing them in the same directory)
  • add this section to app.config of the client application or place it in a new configuration file and call svcutil using the / svcutilConfig switch

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

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

+4
source

I just found out about the visual studio xsd2Code add-in. It does exactly what you want with the Xsd annotation / documentation text moved to the C # xml documentation summary tag.

There is a community version on CodePlex . the paid version has some other nice additional features, so I decided to pay $ 45 for a one-year license. Note. I am not part of the company, just a satisfied customer.

Scott Crowder

+1
source

Source: https://habr.com/ru/post/1387753/


All Articles