When building .NET applications offline, the dotnet restore and build commands don't automatically use locally cached NuGet packages. The workaround involves three steps: locating the local NuGet cache with `dotnet nuget locals all --list`, adding the global-packages directory as a NuGet source with `dotnet nuget add source`, and specifying an explicit package version when running `dotnet add package`. This allows developers to build .NET apps without an internet connection using previously downloaded packages.

2m read timeFrom nodogmablog.bryanhogan.net
Post cover image
Table of contents
Find the Local NuGet CacheAdd this as a source for NuGetUsing add package while offline