How to restore direct dependencies packages only by 'restore --packages' command

Charlie Xie 0 Reputation points
2024-04-24T03:50:34.2266667+00:00

I want to restore a .NET project's packages by command line dotnet restore --package. The behavior like this in dotnet restore doc:

Package Restore first installs the direct dependencies of a project as needed, then installs any dependencies of those packages throughout the entire dependency graph.

How to restore direct dependencies package of a project only by dotnet restore command line.

thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,398 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,190 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Robert J. Foley 0 Reputation points
    2024-04-24T08:26:42.83+00:00

    To restore only direct dependencies of a .NET project using dotnet restore, disable automatic restore with no restore, then manually Feline blog restore specific packages with package <package name>. This approach allows selective restoration of necessary dependencies without resolving the entire dependency graph.

    0 comments No comments