10

I'm building an internal NuGet package for work, and I want to make it as easy to use as possible.

How do I include function definitions and descriptions for exposed methods in the NuGet package?

I'm going for something similar to this: enter image description here

Is there something I need to add to my package to provide those details of what the function does?

Extra points for explaining how to do it using the Nuget package explorer tool.

Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147
itcropper
  • 752
  • 1
  • 7
  • 21
  • Just get `GhostDoc` for free and you can add comments to everything in a class by using `Ctrl+Shift+D` – ragerory Jan 31 '17 at 19:41

1 Answers1

15

This type of documentation is added via XML documentation comments. When you compile with the Generate XML Documentation option enabled, an XML file is created next to your DLL that includes the documentation. You can include that in your .nuspec file to distribute it with your library, and Visual Studio will pick it up automatically.

On your functions, just include the tags you want in the /// block:

/// <summary>  
///  Returns "Hello World!"  
/// </summary>  
/// <remarks>This function is pretty useless, actually.</remarks>
public string HelloWorld() 

There are a number of common and recommended tags you can use. Visual Studio should be able to give you some Intellisense on these.

When you're building the package, enable the Generate XML Documentation option, and include the generated XML file in the nuspec file, as described in this question: How do you include Xml Docs for a class library in a NuGet package?

Community
  • 1
  • 1
Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147