nuget package reference blue icon in visual studio 2017
Asked Answered
J

3

22

For some reason in my console app, couple of the reference that I installed thru nuget shows the blue nuget icon. I can build my project locally, but not after I deploy my project to cloud. The error msg is complaining about not able to find these 2 references. Seems like I can't delete them either by right click(no delete option avaialble). Any idea?

enter image description here

Joashus answered 24/5, 2018 at 1:47 Comment(0)
E
23

nuget package reference blue icon in visual studio 2017

That because you are using the packagereference on the project types that are not .NET Core.

You can edit the .csproj file and check if it contains following ItemGroup:

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
  </ItemGroup>

To resolve this issue, you can delete this PackageReference from your project file, then add those package with nuget package.

Besides, you should check if you have set the Default package management format to PackageReference. If yes, change it to packages.config, then add those two packages with nuget:

enter image description here

Hope this helps.

Enrika answered 30/5, 2018 at 9:1 Comment(5)
I removed the package reference and installed with nuget, it still shows the icon in blue. The format is selected as package.config as well.Devora
I have the same problem. Did you manage to resolve it?Reverse
I fixed the yellow triangle/blue reference by deleting the obj-folder in the project. This was a project that was at one point converted to PackageReference, and then later I changed the branch to one where the project wasn't converted (that is, using packages.config). The obj folder contained a project.assets.json that confused Visual Studio. Make sure to turn on "Show all files and folders" in the solution explorer.Argueta
thanks @Argueta thats exactly what I did, I experimented with using PackageReferences, then reverted the csproj. Did not realize that the that json file was messing with VSRiga
I found in my case that it was easiest to just delete and replace the .csproj file, re-adding files and references manually. This got rid of some old bad references that I hadn't been able to track down just by editing my existing .csproj. The PackageReference/Packages.config error had been the root of it all, but in my case I needed a bigger hammer to get rid of it. (I did delete the obj folder as well.)Fringe
C
0

Happened to me in VS 2022.

Solved by deleting the bin and obj folders, which removed the reference with the blue icon. And after that reinstalled the NuGet packages, which added the references to the csproj file.

update-package -reinstall -project MyProjectName

Catnip answered 3/1, 2023 at 10:56 Comment(0)
M
0
  1. Remove local packages 'C:\Users{USER}.nuget\packages' (or buck-up/zip them somewhere else)
  2. run 'update-package -reinstall -project MyProjectName' in package manager console.
Myrilla answered 16/11, 2023 at 9:42 Comment(1)
Doesn't work: "The -Reinstall parameter does not apply to PackageReference based projects `ProjectName\ProjectName.csproj'"Spreader

© 2022 - 2024 — McMap. All rights reserved.