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 interactive doesn't prompt for DeviceFlow since .NET 6 SDK

See original GitHub issue

Describe the bug

If I use .NET 5 SDK, and call dotnet tool restore --interactive, I get presented with the DeviceFlow authentication flow from NuGet’s MicrosoftCredentialProvider plugin (https://github.com/microsoft/artifacts-credprovider).

I get something like this:

[CredentialProvider]DeviceFlow: https://XXX.pkgs.visualstudio.com/_packaging/XXX/nuget/v3/index.json
[CredentialProvider]ATTENTION: User interaction required.

**********************************************************************

To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXX to authenticate.

**********************************************************************

However, if I need the same thing in .NET 6 SDK (using 6.0.100), the output is silent, I don’t receive any prompt on the output.

I found a workaround to add --verbosity minimal in the command parameters. But without this, it seems that the default verbosity is quiet which doesn’t include the interactive auth flow prompt.

In .NET 5, the verbosity switch didn’t have any effect for dotnet tool restore, I even created issue #16535. but in .NET 6, suddenly, the verbosity is working. It’s just that the default verbosity is too quiet and is missing the important prompts.

To Reproduce

  • ensure that the tool packages to be restored aren’t in NuGet cache
  • ensure that you use feed that needs MicrosoftCredentialProvider auth (https://github.com/microsoft/artifacts-credprovider), I’m using Azure DevOps Artifacts
  • ensure you don’t have any MicrosoftCredentialProvider token already in cache
  • call dotnet tool restore --interactive
  • expected: prompt for device login
  • actual: no output, program keeps running and waiting for the auth

Further technical details

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:41
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

37reactions
tompazourekcommented, Jan 10, 2022

I’ve had the same issue. As a workaround use the -v diag parameter, at least this worked for me

Actually, our workaround was similar, even --verbosity minimal worked.

It’s as if the default verbosity is quiet, which is too quiet.

18reactions
cervesuscommented, Jan 10, 2022

I’ve had the same issue. As a workaround use the -v diag parameter, at least this worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fail to execute "dotnet tool restore --interactive" in Build ...
Fail to execute “dotnet tool restore --interactive” in Build Pipeline when using Azure DevOps Artifact. You could not use the command line ...
Read more >
dotnet tool restore command - .NET CLI
The dotnet tool restore command installs on your machine the .NET local tools that are in scope for the current directory.
Read more >
Troubleshoot .NET tool usage issues
Discover the common issues when running .NET tools and possible solutions.
Read more >
Elevated access for dotnet commands - .NET CLI
dotnet tool install PACKAGEID --tool-path "%ProgramFiles%\dotnet-tools". Run the global tool. Option 1 Use the full path with elevated prompt:.
Read more >
Paket and the .NET SDK / .NET Core CLI tools (dotnet CLI ...
After paket.references files files have been created, run dotnet restore (see restoring packages) to update your projects. In contrast to traditional .NET ......
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