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
{...}
}
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)
So how to generate multiple files (one file per class) with XML-comments from XSDs and WSDLs
You might be able to use the WCFExtras+ http://wcfextrasplus.codeplex.com/.
- Make WCFExtras.dll visible to svcutil.exe (such as by putting them in the same directory)
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>
example command line, where configfile.xml is the config file above:
SvcUtil.exe [service url] /svcutilConfig:[path to configfile.xml]
I just learned about xsd2Code visual studio add-in. It does exactly what you want with the Xsd annotation/documentation text moved into a c# xml documentation summary tag.
There is a community version on CodePlex. The paid version has some other nice advanced features so I decided to pay the $45 for a one year license. Note: I'm not part of the company, just a satisfied customer.
Scott Crowder