How to deprecate a NuGet package?
NuGet recently announced that it is adding support for package deprecation. This was a much needed feature. Here is the guide to deprecating packages on NuGet.
Steps to deprecate
-
Go to Manage Packages page in NuGet website.
-
Select your package and click the edit icon.
-
You will find a deprecation section like the one in the screenshot below
Nuget deprecation menu -
Select the version you want to deprecate. You can select all versions if you are deprecating the whole package.
-
Select a reason.
-
If this package is being deprecated in favour of another, provide information about the alternate package.
-
Save the package.
Client side warnings
Once you have deprecated a package, warning will be shown in the NuGet website. Visual Studio starting from 16.3 (Visual Studio 2019) will show a warning for deprecated packages and show the warning message and alternate packages info.
Undoing Deprecation of a package
Okay now if you have started to work on your old package again and you want to undo the deprecation process. Here is how you can do it.
- Go to the deprecation section of your package as mentioned in the steps above.
- Uncheck the check boxes under reasons for deprecating and save.
- Your package is no longer deprecated.
Note: Deprecated packages are still searchable in NuGet. You can unlist your packages if you do not want them to be visible.