.NET and NuGet
Add and restore packages
Add a package and restore a project, the same as with nuget.org.
Add a package the usual way. You get the newest version the rules allow. It can be older than the newest one on nuget.org.
$ dotnet add package Newtonsoft.Json ... info : Package 'Newtonsoft.Json' is compatible with all the specified frameworks in project '/work/orders-api/orders-api.csproj'. info : PackageReference for package 'Newtonsoft.Json' version '13.0.4' added to file '/work/orders-api/orders-api.csproj'. info : Writing assets file to disk. Path: /work/orders-api/obj/project.assets.json log : Restored /work/orders-api/orders-api.csproj (in 12.31 sec). $ dotnet list package Project 'orders-api' has the following package references [net8.0]: Top-level Package Requested Resolved > Newtonsoft.Json 13.0.4 13.0.4
Captured by running these commands against a real ForgeRepo™.
Restore works the same way on any machine and in a pipeline:
$ grep PackageReference orders-api.csproj <PackageReference Include="Newtonsoft.Json" Version="13.0.4" /> $ dotnet restore Determining projects to restore... Restored /work/orders-api/orders-api.csproj (in 601 ms).
Captured by running these commands against a real ForgeRepo™.