Working with dependencies in .NET

NuGet

Creating a packages.lock.json file

  1. Enable lock-file support (for .NET 5 and above):

    dotnet nuget locals all --clear
  2. Install dependencies:

    dotnet restore --use-lock-file

Creating a paket.lock file

  1. Create a lock-file:
    paket install

Working with an sln manifest

In case an *.sln manifest is detected while scanning a directory the list of target manifests will be composed of the components described in it. The components which are present in the solution directory but not included will be ignored.

Support for Directory.Packages.props

The agent automatically detects the Directory.Packages.props file when scanning .csproj projects and uses the package versions defined in it. The file is located by walking up the directory tree from the project location to the scan root.

General Information

  • Within the .NET ecosystem, the main manifest is *.csproj, with packages.lock.json serving as the lock file;
  • The deps.json file is considered a separate lock file that is automatically generated and is not linked to any other manifests. It specifies dependencies required for the target runtime.
Was this page helpful?