Using the dotnet command line tool, how can I add a reference to an existing local package that is not downloaded with NuGet?
I have tried addin
There isn't a way to directly install a single .nupkg package. NuGet can only install and restore from feeds, so you'll need to add the directory where the package is in as a feed.
To do this, add a NuGet.Config file that adds the location of the directory as a feed, so you don't have to add the source parameter to each NuGet-related command (especially dotnet restore):
Alternatively in .NET Core 2.0 tools / NuGet 4.3.0, you could also add the source directly to the .csproj file that is supposed to consume the NuGet feed:
$(RestoreSources);../foo/bin/Debug;https://api.nuget.org/v3/index.json
This will make all commands be able to use the package:
dotnet add package foo (optionally add -v 1.0.0)dotnet restoredotnet runNote that during development, if you change the NuGet package, but don't increment its version in both the project that produces the .nupkg file and in the project that consumes it, you'll need to clear your local packages cache before restoring again:
dotnet nuget locals all --clear
dotnet restore
I have created a small example project at https://github.com/dasMulli/LocalNupkgExample