I'm wondering why my Visual Studio missing "Remove unused references" on right click menu project and references both.
Please Don't tell me try Migrate packages.config to PackageReference, I just did it, but nothing change.
I'm wondering why my Visual Studio missing "Remove unused references" on right click menu project and references both.
Please Don't tell me try Migrate packages.config to PackageReference, I just did it, but nothing change.
First of all you need to have an SDK style csproj like it is said here.
Example:
<Project Sdk="Microsoft.NET.Sdk"/>
Second, you must have it enabled like @Stan1k mentioned in his answer:
Microsoft says that the feature is off by default. You need to enable it from Tools > Options > Text Editor > C# > Advanced tab > Show "Remove Unused References" command in Solution Explorer (experimental).
And finally make sure you you run dotnet restore in the project console and build the projects (this was the issue for my why it was not showing).
Do you have an older Visual Studio Version? This Feature got released with Version 16.10.
Also notice this statement from the article
Microsoft says that the feature is off by default. You need to enable it from Tools > Options > Text Editor > C# > Advanced tab.
The option appears in Options>C#>Advanced and is on. When you right click on project the option does not appear making me think all references are being used. Perhaps depends on the project.