Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mark NuGet packages on Azure DevOps feed as deprecated to use nuget search or dotnet list package --deprecated?

In Azure DevOps Builds, checks for deprecated and vulnerable nuget packages work great using:

dotnet list "HappySolution.sln" package --deprecated --source https://api.nuget.org/v3/index.json --include-transitive
dotnet list "HappySolution.sln" package --vulnerable --source https://api.nuget.org/v3/index.json --include-transitive

Which works great for packages available via nuget.org, however internal packages within an on-prem package feed in Azure DevOps should never be published to nuget.org. How can the build check that these internal packages are now deprecated?

A list of packages could be generated per solution, then compared to the results of a "Deprecated" View that the deprecated packages are promoted to:

nuget list -source https://happy.sos/DefaultCollection/_packaging/InternalNuget@Deprecated/nuget/v3/index.json -AllVersions

but nuget list is now deprecated in favor of nuget search, which does not support the -AllVersions option.

In other words,

dotnet list "HappySolution.sln" package --deprecated --source https://happy.sos/DefaultCollection/_packaging/InternalNuget@Deprecated/nuget/v3/index.json --include-transitive

always returns that a given project has no deprecated packages, when internally it needs to.

like image 533
thisisntjared Avatar asked Oct 16 '25 19:10

thisisntjared


1 Answers

If you are using Azure Artifacts to host your own custom NuGet feeds, then the deprecated package feature isn't available yet.

You can only unlist/delete a package instead with Azure Artifacts.

BTW, many other custom NuGet feed solutions do support that feature, which you can migrate to if you want that feature.

like image 145
Lex Li Avatar answered Oct 18 '25 16:10

Lex Li