===============================
If your project does not reference any other projects or just reference a project which does not install the same nuget package, I think the issue is related to your project itself or VS environment.
And in this situation, it is quite strange that the blue icon of the nuget package still stays on the solution explorer while you have already uninstalled the nuget package.
Please try the following suggestions:
1) disable any third party extensions under Extensions-->Manage Extensions-->Installed
2) clean nuget caches and reset vs settings under Tools-->Import and Export settings-->Reset all settings
3) then close VS, delete cache files under
C:\Users\xxx(current user)\AppData\Local\Microsoft\VisualStudio\16.0_xxx\ComponentModelCache
and also delete .vs
hidden folder, bin
and obj
folder.
4) then restart VS to test whether the issue persists.
Besides, you could use devenv /safemode to start a clean and initial VS and then test your project.
=================================
If your situation is this one:
Your project B has referenced a project called Project A while A has also installed the same nuget package. And project A uses PackageReference nuget management format.
Although you have uninstall the nuget package on Project B, your obj
folder still has files like project.assert.json
,xxx.nuget.g.props
which is a feature of PackageReference. Due to it, the nuget package management format of Project B is the same as the Project A and will transmit the dll from the Project A into Project B so that you can use the dll in the project B.
And that delete .vs
hidden folder will remove the nuget package format PackageReference of Project B since you already uninstall all the nuget packages on Project B but the PackageReference content of obj
folder still exist.
So you should close VS, delete .vs hidden folder, bin and obj folder of the Project B at the same time.
Note: Rebuild and Clean will not delete the previous restore files.
If this does not work, I think you have written this xml node under B.csproj
file:
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
So you should check in your project B carefully and it will still restore the files project.assert.json
,xxx.nuget.g.props
,.... as PackageReference.
Therefore, if you have, delete this node, also delete .vs
hidden folder, bin
and obj
folder.
%userprofile%\.nuget\packages\
, then restarting VS. – Ian Kemp