Oliver Henriksson
Oliver Henriksson

Reputation: 84

'Install package' quick action not appearing in Visual Studio

Update 2024-02-27

I couldn't tell you precisely which version solved it, but after updating to 17.9.2 it now works as expected. According to my teacher it was something wrong with how a cache was generated, or rather how it was not generated, that was the cause of the issue.


Original post

I'm using Visual Studio 2022 Community Edition, and it has a quick actions popup for quickly solving a variety of problems. One of the suggestions it can give, but that I am not receiving, is to install packages through the NuGet package manager.

For context this is C#/.NET, but I don't think the language or framework matters in this case.

Example image of how it should look like:

I get all the "Change 'Host' to" and whatnot suggestions so quick actions as such are otherwise working as expected. I have the same project type, the same text for it to suggest, and the same everything as far as I can know, but for some reason, I and a couple of other students don't get that "Install package" suggestion that most of the class and all teachers are getting. This specific package is not the cause of the issue, for example, Newtonsoft.Json also fails to get suggested.

In all my googling I couldn't even find that specific suggestion being mentioned let alone anything relevant to how I could fix it. Manual NuGet package installation through the manager is working as normal, updating didn't help, I can't find any setting in Visual Studio that would affect it negatively, etc.

Edit: I made a comment to Bowman but for increased visibility: I have previously added the standard NuGet package source, (but it was missing on my fresh install which I think isn't normal?) so that didn't solve this.

I've now also tried resetting the package manager to default in every way I could find to do that but that also made no difference.

By request, contents of my NuGet.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </packageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

Upvotes: 1

Views: 681

Answers (2)

CleverFox
CleverFox

Reputation: 1

I found that my option settings was messed up.

  1. Saved current settings
  2. Reset all settings to default
  3. Imported 'Fonts & Colors' & Menu's as I had custom toolbar

This is what fixed it for me.

Upvotes: 0

Bowman Zhu
Bowman Zhu

Reputation: 7146

I am able to reproduce your situation:

enter image description here

And I am able to fix it on my side:

enter image description here

In my situation, the issue comes from there is no available package source, and because of this, so package suggestions will not pop out.

You could check Tools -> Options -> Nuget Package Manager -> Package sources:

enter image description here

The API link source of the nuget gallery is:

https://api.nuget.org/v3/index.json

Add it as the source, then on my side the intellisence will work.

Upvotes: 0

Related Questions