NuGet packages
Microsoft provides best practices to give NuGet package authors a reference to create and publish high-quality packages.
.NET project file analyzers provides rules for most of them:
Rule | Recommendation |
---|---|
Proj0200 | Explicitly define the package as packable. |
Proj0201 | Consider using SemVer to version your NuGet package. |
Proj0202 | Do include a short description (up to 4000 characters) to describe your package. |
Proj0203 | Do use the author field for your or your organization’s “pretty name.” |
Proj0204 | Do include several tags with key terms related to your package to enhance discoverability. |
Proj0205 | Do include a link to an associated repository |
Proj0206 | Do include a link to an associated project or company website. |
Proj0207 | Do add a copyright notice to your package with “Copyright (c) <name/company> |
Proj0208 | Do include release notes with each update describing what changes were made. |
Proj0209 | Do add a README markdown file that provides an overview of what your package does and how to get started. |
Proj0210 | Do include a license expression or license file in your package. |
Proj0211 | Do not use the deprecated PackageLicenseUrl to include a license. |
Proj0212 | Consider including an icon with your package to help to visually differentiate it. It’s a relatively small addition that can improve perception of package quality. |
Proj0213 | Consider adding the icon url for maximum compatibility. |
Proj0214 | Do include the package id. |
Proj0216 | define the product name. |
none | Consider choosing a NuGet package name with a prefix that meets NuGet’s prefix reservation criteria. |
Proj0215 | Do use an image that is 128x128 and has a transparent background (PNG) for the best viewing results. |
Consider setting up Source Link to automatically add source control metadata to your NuGet package and make your library easier to debug. | |
Do choose an open source license to make your package open source. | |
Proj0243 | Generate a software bill of materials to be compliant with USA legislations. |
Proj0244 | Include source code documentation for public API. |
Further reading
- https://learn.microsoft.com/nuget/reference/msbuild-targets