.net-corenugetteamcity

DotNet CLI: Restore Nuget package without adding to project


We build our dotnet artifacts on a TeamCity server and want to include the SqlPackage.CommandLine binaries alongside our build output. Running dotnet add package SqlPackage.CommandLine yields "Could not find any projects in C:\build". Can someone recommend a way to grab the nuget output without adding it to a project?


Solution

  • You can just download the NuGet package directly from nuget.org: curl -O -L https://www.nuget.org/api/v2/package/SqlPackage.CommandLine does the trick and downloads the latest version.

    If you need the contents from that package, you can simply unarchive it with zip utils afterwards