Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet list package doesn't restore #13406

Open
richlander opened this issue Apr 23, 2024 · 4 comments · May be fixed by #14119 or dotnet/sdk#47400
Open

dotnet list package doesn't restore #13406

richlander opened this issue Apr 23, 2024 · 4 comments · May be fixed by #14119 or dotnet/sdk#47400
Assignees
Labels
Functionality:ListPackage dotnet.exe list package Priority:2 Issues for the current backlog. Product:dotnet.exe Type:DCR Design Change Request

Comments

@richlander
Copy link

This behavior is incorrect, inconsistent, and inconvenient.

We have had implicit restore for dotnet build for many years. dotnet list package would benefit from this same behavior.

You first need to build the project in order to have the assets needed for this command to process.

Per docs. That's unfortunate.

Observed behavior follows.

$ dotnet new console -o nugettest
$ cd nugettest
$ rm -r obj
$ dotnet list package
No assets file was found for `/Users/rich/nuget-test/nuget-test.csproj`. Please run restore before running this command.
$ dotnet restore
  Determining projects to restore...
  Restored /Users/rich/nuget-test/nuget-test.csproj (in 52 ms)
$ dotnet list package
Project 'nugettest' has the following package references
   [net8.0]: No packages were found for this framework.
$ dotnet add package System.Text.Json --version 8.0.3
$ dotnet list package                                
Project 'nuget-test' has the following package references
   [net8.0]: 
   Top-level Package       Requested   Resolved
   > System.Text.Json      8.0.3       8.0.3   
$ echo manually add package
manually add package
$ grep PackageRef nuget-test.csproj  

    <PackageReference Include="System.Text.Json" Version="8.0.3" />
    <PackageReference Include="System.Text.RegularExpressions" Version="4.3.0" />
dotnet list package              
Project 'nuget-test' has the following package references
   [net8.0]: 
   Top-level Package       Requested   Resolved
   > System.Text.Json      8.0.3       8.0.3
$ dotnet list package --vulnerable --include-transitive

The following sources were used:
   https://api.nuget.org/v3/index.json

The given project `nuget-test` has no vulnerable packages given the current sources.
Copy link
Contributor

@richlander Issue is missing Type label, remember to add a Type label

@dotnet-policy-service dotnet-policy-service bot added the missing-required-type The required type label is missing. label Apr 23, 2024
@nkolev92
Copy link
Member

The original design was to make it offline, similar to other list commands, which is why it doesn't call restore implicitly.

@nkolev92 nkolev92 added Type:DCR Design Change Request Functionality:ListPackage dotnet.exe list package labels Apr 23, 2024
@dotnet-policy-service dotnet-policy-service bot removed the missing-required-type The required type label is missing. label Apr 23, 2024
@richlander
Copy link
Author

That doesn't make sense to me. The feature requires a restore to function and cannot detect when it will produce bad results (as I demonstrates).

Sounds like a broken design to me.

@jebriede jebriede added the Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. label Apr 25, 2024
@aortiz-msft
Copy link
Contributor

Assigning to @Nigusu-Allehu since this is related to other work happening.

@Nigusu-Allehu Nigusu-Allehu added Priority:2 Issues for the current backlog. and removed Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:ListPackage dotnet.exe list package Priority:2 Issues for the current backlog. Product:dotnet.exe Type:DCR Design Change Request
Projects
None yet
6 participants