0

I am implementing Xamarin iOS Bindings Library to bind an Objective-C framework. I would like it to contain XML documentation comments if it's even possible.

Is there any way to grab them from Objective-C Headers or at least to add them manually to the resulting bound classes somehow?

I tried adding XML comments to interfaces described in ApiDefinitions.cs, but the generated classes in obj/Debug/ios/Namespace/*.g.cs remain undocumented, the XML documentation file also remains empty.

Olexander Ivanitskyi
  • 2,202
  • 17
  • 32

2 Answers2

1

You can use the mdoc to generate the XML documentation for bindings. You can find an example here https://github.com/mono/monotouch-bindings/blob/master/Rules.make#L7

Prashant Cholachagudda
  • 13,012
  • 23
  • 97
  • 162
1

This manual was useful to generate the documentation. The next steps are done:

  1. Add a mdoc tools folder to my solution taken from here.
  2. Add an empty Mdoc folder to the Bindings project. It will contain generated mdoc documentation files.
  3. Add the following lines to the post-build event of the Bindings project:
$(SolutionDir)tools\mdoc\mdoc update -L "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0" --out $(ProjectDir)Mdoc $(TargetPath)
$(SolutionDir)tools\mdoc\mdoc export-msxdoc $(ProjectDir)Mdoc

The first line generates or updates a bunch of XML files in the Mdoc folder. These files can be included to the project (with Build Action None) and filled with your documentation manually or using the Monodoc browser. Next time the project is rebuilt, the files will be updated without removing the already written documentation. Check the mdoc-update for details.

The second line converts the Monodoc XML files to Microsoft XML Documentation file that can be shipped along with the output DLL file. Check the mdoc-export-msxdoc for details.

Olexander Ivanitskyi
  • 2,202
  • 17
  • 32
  • Hi Olexander, whats the path you mentioned in first line to post bild event. – raheem52 Apr 19 '18 at 10:16
  • @raheem52, from the [mdoc-update](http://docs.go-mono.com/?link=man%3Amdoc-update(1)) "-L, --lib=DIRECTORY - Add DIRECTORY to the assembly search path, so that dependencies of ASSEMBLIES can be found without documenting those assemblies." - In this case this is Xamarin.iOS reference libraries path. – Olexander Ivanitskyi Apr 25 '18 at 16:31