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.

1
  • Just get GhostDoc for free and you can add comments to everything in a class by using Ctrl+Shift+D Commented Jan 31, 2017 at 19:41

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.