NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Restore NuGet packages should give message if restore disabled #6016

Open rohit21agrawal opened 7 years ago

rohit21agrawal commented 7 years ago

Filed from FEEDBACKTICKET 506597

  1. Go to Tools / Options / NuGet Package Manager / General and disable "Allow NuGet to download missing packages"

(Admittedly, I was a actually a little unsure about what exactly this option did or when one might want to disable it. Better doc might help there, but that's a separate issue. Anyway, I needed to uncheck it because autorestore breaks another solution I sometimes work on.)

  1. Open a VS solution that uses NuGet.
  2. Right click on the solution and do "Restore NuGet Packages"

Result: It seems like nothing happens rather than seeing an obvious message explaining why nothing is happening.

Expected: Should show a user visible message here that explains what's going on.

It turns out that that the error window actually does include this message "NuGet restore is currently disabled. To enable it, open the Visual Studio Options dialog, click on the Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also enable it by setting the environment variable 'EnableNuGetPackageRestore' to 'true'."

That's a good message, and the error window is shown, but the problem is that I had a couple hundred other messages there (mostly errors caused by the packages not being restored yet). That noise drowns out this message and there's nothing to actually draw the user's attention to that particular message. It's not scrolled to, selected, or anything.

Instead should probably do one of these options (pick your favorite):

  1. Put the message in the "Package Manager" output window. That's where I actually looked for the message.
  2. Show a message box popup (why not?).
  3. Select this appropiate message in the error window and scroll to it. I'm not sure how hard that is, but if did (1) or (2) above it wouldn't be necessary.
donnie-msft commented 4 years ago

Just hit this and was unsure why Restore was doing nothing.

There is an error message but it's only visible if "Build + IntelliSense" is enabled in the Error List. image

If the setting to allow NuGet to restore is disabled: image

Then we should also disable the Restore command in the Solution context menu and provide a tooltip explaining why: image

And finally, the error should be more prominent. Several suggestions in the original issue above.

donnie-msft commented 1 year ago

Related: changes to the error message in https://github.com/NuGet/Home/issues/5624