Skip to content

[Breaking change]: dotnet package list command behavior change #46103

Closed
@Nigusu-Allehu

Description

@Nigusu-Allehu

Description

The dotnet package list command now performs a restore before listing packages to ensure accurate and up-to-date results. This is a behavioral change from the previous implementation where the command did not require a restore step.

Additionally, if the restore operation fails, an error message is logged. The error is displayed in both plain text and JSON formats based on the command usage.

Version

.NET 10 Preview 4

Previous behavior

The dotnet package list command listed project packages without performing a restore. If a restore was needed, users had to perform it manually before running the command.

New behavior

The dotnet package list command now automatically performs a restore operation before listing packages, ensuring the output reflects the latest state of the project dependencies. If the restore fails, the command will not proceed to list packages and will log an error message as described above.

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

This change was introduced to ensure the dotnet package list command provides accurate and up-to-date package information.

Recommended action

If this change causes issues in your workflow:

  1. Users who want to bypass the implicit restore can use the --no-restore option with the dotnet package list command. This allows them to opt out of the restore step if it is not required for their workflow.
  2. Ensure your project is ready for restore before running the dotnet package list command.
  3. Alternatively, you can manually run dotnet restore before invoking the command to decouple the restore step.

Feature area

SDK

Affected APIs

N/A


Associated WorkItem - 437608

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions