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:
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.
After you install a NuGet package, you can then make a reference to it in your code with the using <namespace> statement, where <namespace> is the name of package you're using. After you've made a reference, you can then call the package through its API.
Actually you should add -Symbols to the end of command to create a symbols package. You shouldn't add pdb files to main nuget package.
nuspec file is not required to create packages for SDK-style projects (typically . NET Core and . NET Standard projects that use the SDK attribute).
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With