question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Dotnet tool restore' does not work correctly when NUGET_PACKAGES (global-packages) is set to an alternative location

See original GitHub issue

Issue Title

‘dotnet tool restore’ does not work correctly when NUGET_PACKAGES (global-packages) is set to an alternative location.

Description

If you set NUGET_PACKAGES to an alternate folder. “D:\cache” on a build agent for instance,

dotnet tool restore # and then directly after
dotnet paket info # or paket <whatever>.

will fail with $lastexitcode=1 and Run "dotnet tool restore" to make the "paket" command available.

The same error happens for at least two other tools as well. gitversion.tool and dotnet-fsharplint.

Repro steps

See this minimal example: https://github.com/da9l/dotnetpaketProblem_minimalExample/blob/master/readme.md

Expected behavior

it should work.

Actual behavior

fail with $lastexitcode=1 and Run "dotnet tool restore" to make the "paket" command available.

Known workarounds

Don’t set NUGET_PACKAGES to anything non-standard.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:19
  • Comments:14

github_iconTop GitHub Comments

26reactions
jespergustinmsftcommented, Oct 4, 2021

I just want to share my findings; that I managed to work around it by deleting the %USERPROFILE%.dotnet\toolResolverCache folder before running dotnet tool restore.

10reactions
slavcommented, Jan 24, 2022

deleting toolResolverCache seems to fix the issue. On linux it’s at ~/.dotnet/toolResolverCache

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet restore command - .NET CLI
To restore the dependencies, NuGet needs the feeds where the packages are located. Feeds are usually provided via the nuget.config configuration ...
Read more >
Tool not found after `dotnet tool restore` even ... - YouTrack
Tool not found after `dotnet tool restore` even though `dotnet tool list --local` shows the tool as present. This issue has only become...
Read more >
Is it possible to change the location of packages for NuGet?
I could not get the latest nuget (2.8.5) to find a packages folder outside of the standard location without enabling package restore.
Read more >
Dotnet restore vs nuget restore. Share. In my code repo, there
I am trying to restore NuGet packages in my project using the CLI. ... It is a common problem with the use of...
Read more >
.NET Core 3 Local Tools
The tool is installed to the global nuget package cache, like a typical nuget package, if the user does not have the package...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found