Search code examples
nuget

NuGet equivalent of Maven Install


I'm wondering how to install a package locally so I can test it without having to run a CI job, just like what mvn install does. Is this possible with NuGet?

I know there's nuget add but that requires many manual steps (build the package, copy it over into the proper package directory, etc.). I couldn't find much else, is there anything NuGet (or IDEs) offer to make this easier?


Solution

  • I wrote up two bash functions to help out with this kind of thing:

    pack () {
        dotnet pack -c Release -o ./packages -p:PackageVersion="$1"
    }
    
    
    add () {
        for nupkg in packages/*.nupkg
        do
            nuget add "$nupkg" -source ~/.nuget/custom-local-packages
        done
    }