Get your first NuGet package published and consumed through DepAegis in under five minutes. This guide walks you through creating a class library, packing it, pushing it to your private registry, and installing it in another project.
dotnet --versionapp.depaegis.comDepAegis authenticates NuGet operations using Personal Access Tokens (PATs). Create one from the DepAegis dashboard:
nuget-cli)Register DepAegis as a NuGet package source. The NuGet endpoint is https://app.depaegis.com/api/v1/nuget/v3/index.json.
dotnet nuget add source "https://app.depaegis.com/api/v1/nuget/v3/index.json" \
--name depaegis \
--username "<your-username>" \
--password "<your-access-token>" \
--store-password-in-clear-text--store-password-in-clear-text flag is required because the .NET SDK cannot prompt for credentials during dotnet push or dotnet restorein non-interactive environments.Alternatively, place a nuget.config file in your project or repository root:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="depaegis"
value="https://app.depaegis.com/api/v1/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<depaegis>
<add key="Username" value="<your-username>" />
<add key="ClearTextPassword" value="<your-access-token>" />
</depaegis>
</packageSourceCredentials>
</configuration>nuget.config approach, add it to your .gitignore to avoid leaking credentials. For team setups, consider using environment variable substitution or a CI secret store.Create a new class library project that will become your NuGet package:
mkdir MyCompany.Utils && cd MyCompany.Utils
dotnet new classlib -n MyCompany.UtilsAdd some code to the default class file. For example, open Class1.cs and replace its contents:
namespace MyCompany.Utils;
public static class StringExtensions
{
public static bool IsNullOrEmpty(this string? value)
=> string.IsNullOrEmpty(value);
}Build and pack the library into a .nupkg file:
dotnet pack -c ReleaseThe resulting package will be in bin/Release/MyCompany.Utils.1.0.0.nupkg. You can customize the version, description, and other metadata in the .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<PackageId>MyCompany.Utils</PackageId>
<Version>1.0.0</Version>
<Authors>Your Name</Authors>
<Description>Shared utility extensions for MyCompany projects.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
</Project>Publish the package to your DepAegis registry:
dotnet nuget push "bin/Release/MyCompany.Utils.1.0.0.nupkg" \
--source depaegisIf you did not name your source depaegis, use the full URL instead:
dotnet nuget push "bin/Release/MyCompany.Utils.1.0.0.nupkg" \
--source "https://app.depaegis.com/api/v1/nuget/v3/index.json" \
--api-key "<your-access-token>"In another project, install the package from DepAegis:
dotnet add package MyCompany.Utils --source depaegisOr add it directly to your .csproj file:
<ItemGroup>
<PackageReference Include="MyCompany.Utils" Version="1.0.0" />
</ItemGroup>Then restore and use it:
dotnet restore --source depaegisusing MyCompany.Utils;
var input = Console.ReadLine();
if (input.IsNullOrEmpty())
{
Console.WriteLine("No input provided.");
}Open the DepAegis dashboard and navigate to the package page for MyCompany.Utils. You will see: