Skip to content

Package list does not respect build configuration #15158

Backlog

Description

@tisonv

NuGet Product Used

dotnet.exe

Product Version

10.0.404

Worked before?

don't think so

Impact

It bothers me. A fix would be nice

Repro Steps & Context

My solutions have several configurations
dotnet package list --vulnerable --include-transitive only works with a configuration named Debug

I have a CI configuration which includes all tests and a Debug configuration that does not include any tests

In my audit pipeline, I restore then check for vulnerable nugets
As intended, dotnet restore ignore the tests projects.
dotnet package list does not ignore them and will display a Assets file not found

Expected behavior:
dotnet package list should ignore those projects

Workaround:
Enabling all tests projects in the Debug configuration but it is not what Debug is intended for

Verbose Logs

dotnet restore

La génération a démarré 25/11/2026 12:03:12.
     1>Projet "D:\Agent\_work\3\s\Ldap.Api.slnx" sur le nœud 1 (Restore cible(s)).
     1>ValidateSolutionConfiguration:
         Génération de la configuration de solution "Debug|x64".
       ValidateProjects:
         Le projet "IntegrationTests" n'est pas sélectionné dans le cadre d'une génération dans la configuration de solution "Debug|x64".
         Le projet "NonFunctionalTests" n'est pas sélectionné dans le cadre d'une génération dans la configuration de solution "Debug|x64".
         Le projet "UnitTests" n'est pas sélectionné dans le cadre d'une génération dans la configuration de solution "Debug|x64".



dotnet package list

Fichier de ressources introuvable pour `D:\\Agent\_work\3\s\FunctionalTests\FunctionalTests.csproj`. Effectuez une restauration avant d’exécuter cette commande.

Les sources suivantes ont été utilisées :
   https://api.nuget.org/v3/index.json

Le projet spécifié 'Api' n'a aucun package vulnérable compte tenu des sources actuelles.
[...]

Activity

  1. jeffkl commented on Nov 25, 2026

    @jeffkl
    Contributor

    Triage

    Valid bug in dotnet package list. Solution restore respects the selected configuration, but package listing enumerates every project in the solution—including projects excluded from that configuration. If an excluded project has no assets file, the command reports Assets file not found and exits with code 1.

    I reproduced this with the reported vulnerability options on .NET SDK 11.0.100. I could not verify the behavior on the reported .NET SDK 10.0.404.

    Workaround

    Create a solution filter (.slnf) containing only the projects to audit, then run:

    dotnet package list --project Debug.slnf --vulnerable --include-transitive

    This succeeded in the repro. The filter will need to be maintained as the desired audit scope changes.

    Fix direction

    Align project selection with the solution configuration used for restore, and support selecting the configuration and platform consistently during restore and project evaluation. Changing the default audit scope needs a compatibility decision.

    Relevant code:

    The CLI implicitly restores by default starting with .NET 10: dotnet package list restore behavior.

  2. added
    Priority:3
    Functionality:ListPackage
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Functionality:ListPackagePriority:3Type:Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions