Learn how to install and restore packages from DepAegis into your .NET projects using the dotnet CLI, PackageReference, and Visual Studio.
The easiest way to add a package from DepAegis is the dotnet add package command:
dotnet add package MyCompany.UtilsTo install a specific version:
dotnet add package MyCompany.Utils --version 2.1.0To install a pre-release version:
dotnet add package MyCompany.Utils --version 2.2.0-beta.1 --prereleasedotnet add package will search all configured sources. Make sure DepAegis is configured as a source (see Configuring NuGet) and that you have a valid API key or credential.You can also add packages directly to your .csproj file using a PackageReference element:
<ItemGroup>
<PackageReference Include="MyCompany.Utils" Version="2.1.0" />
<PackageReference Include="MyCompany.Logging" Version="1.0.0-beta.2" />
</ItemGroup>After editing the .csproj, run dotnet restore to download and resolve the packages.
dotnet restoredownloads all packages listed in your project's dependencies:
dotnet restoreTo restore from a specific source only:
dotnet restore --source "DepAegis"This is useful for verifying that a private package is available on DepAegis without hitting nuget.org.
NuGet supports version ranges in PackageReference to control which versions are acceptable during restore:
| Notation | Meaning | Resolved Version |
|---|---|---|
1.0.0 | Exact version only | 1.0.0 |
[1.0.0, 2.0.0) | >= 1.0.0, less than 2.0.0 | Highest 1.x |
[1.0.0, ) | >= 1.0.0, no upper bound | Highest available |
(1.0.0, 2.0.0] | Greater than 1.0.0, <= 2.0.0 | Highest up to 2.0.0 |
1.0.* | Any 1.0.x patch | Highest 1.0.x |
[1.0.0, 2.0.0) to avoid unexpected breaking changes. Use Dependency Firewall policies to enforce version constraints organization-wide.When running in CI/CD pipelines, you need to provide DepAegis credentials without interactive prompts. The recommended approach is to configure the source and API key in your CI script:
# Add source with API key from CI secret
dotnet nuget add source "https://app.depaegis.com/api/v1/nuget/v3/index.json" \
--name "DepAegis" \
--username "ci-user" \
--store-password-in-clear-text \
--password "$DEPAEGIS_API_KEY"
# Restore packages
dotnet restoreAlternatively, you can use a nuget.config committed to the repository with the source URL (but not the API key), and inject credentials via environment variable:
# nuget.config (committed to repo)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="DepAegis" value="https://app.depaegis.com/api/v1/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>If packages are not being found on DepAegis, check these common issues:
Verify the source is registered:
dotnet nuget list sourceIf DepAegis is not listed, add it (see Configuring NuGet).
Ensure your API key is valid and has Read permissions:
dotnet nuget list source
# Check if credentials are stored for DepAegis sourceRe-set the API key if needed:
dotnet nuget setapikey "your-new-api-key" --source "DepAegis"The NuGet v3 feed URL must end with /v3/index.json. Verify the URL in your nuget.config:
# Correct
https://app.depaegis.com/api/v1/nuget/v3/index.json
# Wrong (missing v3 endpoint)
https://app.depaegis.com/nugetIf you see Unable to find package, check:
If a package fails security scanning, it may be quarantined. Check the DepAegis dashboard for vulnerability reports. See Vulnerability Scanning for details on quarantine policies.