NuGet is .NET's main online repository, and is where libraries are downloaded from when you run dotnet add package.
To configure Nexus to proxy for this, first create a new blob store for its artifactsThis step is optional, if you want to store the cached artifacts in their own sub-directory..
Then create a new repository, of type nuget (proxy).
To configure the repo:
- Give the repo a name (e.g. nuget-proxy).
- Use the suggested URL for the remote repository (https://api.nuget.org/v3/index.json).
- If you want to make downloaded artifacts immutable, set the Maximum component age to -1.
- Configure the blob store you want to keep downloaded artifacts in.
On the client computer, we need to tell NuGet that it should download libraries from our instance of Nexus, instead of the usual nuget.org:
dotnet nuget remove source nuget.org dotnet nuget add source \ http://nexus3:8081/repository/nuget-proxy/index.json \ --name nuget-proxy
If we now add a package, we can see it appear in the Nexus admin console, where it will be available the next time it is requested.
|↵1||This step is optional, if you want to store the cached artifacts in their own sub-directory.|