dotnet tool install -g unable to resolve

Viewed 491

I have the .NET 5 SDK installed, but I do not have Visual Studio installed.

Whenever I tried to perform a tool installation, example dotnet tool install -g csharprepl, it always results in:

error NU1100: Unable to resolve 'csharprepl (>= 0.0.0)' for 'net5.0'.
error NU1100: Unable to resolve 'csharprepl (>= 0.0.0)' for 'net5.0/any'.
The tool package could not be restored.
Tool 'csharprepl' 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.

How do I use dotnet tool install in the absence of Visual Studio?

1 Answers

I had this same problem from a fresh install of win10/.netcore (without Visual Studio) - it seems that the default NuGet.config doesn't have the package sources setup by default (at least for me).

To resolve this, I added the following packageSource config at %AppData%\NuGet\

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    </packageSources>
</configuration>

Edit: Additionally, you may need to download NuGet.exe to a tools folder, and add this to your PATH to use nuget.

Related