Sdk: Support `dotnet tool install` from local nuget package file

Created on 7 Sep 2020  路  2Comments  路  Source: dotnet/sdk

Is there are way to install dotnet tools from nupkg files created by dotnet pack <project>?

I want to quickly install and test my CLI tool but dotnet tool install requires installation from a nuget source.
I can create a local nuget source with nuget add source d:\path\to\nuget\files but a way to directly install nupkg files would be great

>dotnet tool install -g My.Package.1.0.0.nupkg
error NU1101: Unable to find package my.package.cli.1.0.0.nupkg. No packages exist with this id in source(s): dotnet.myget.org roslyn, local, Microsoft Visual Studio Offline Packages, nuget.org
The tool package could not be restored.
Tool 'my.package.1.0.0.nupkg' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
>dotnet --list-sdks
3.1.201 [C:\Program Files\dotnet\sdk]
3.1.302 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
5.0.100-preview.7.20366.6 [C:\Program Files\dotnet\sdk]
needs triage

Most helpful comment

I think that you can use:
dotnet tool install --global --add-source <path-to-your-nuget-package> <tool-name>

All 2 comments

I think that you can use:
dotnet tool install --global --add-source <path-to-your-nuget-package> <tool-name>

I think that you can use:
dotnet tool install --global --add-source <path-to-your-nuget-package> <tool-name>

Just a quick note because I did the mistake, <path-to-your-nuget-package> is the path of the folder, not the nupkg file. File name is loaded from <tool-name>

Was this page helpful?
0 / 5 - 0 ratings