You can now easily remove the unused references from your project or solution directly from the Visual Studio. Visual Studio allows “Remove Unused References” for any NuGet packages or projects which are not in use. This is extremely helpful in clean up project references. We add several NuGet Packages; some of them we used, some we just kept in explore state and not used in a real solution. Having these packages and project references unnecessarily increases your packages. So it is always better to clean up project references and NuGet packages that are not in used.
Remove Unused References
Clean up project references and NuGet Packages often more manageable when the solution is small, and we know precisely what has been used in the solution. For any large-scale solution, where several packages are in use, it’s quite difficult for a developer to find out them or could be time-consuming.
With the latest updates of Visual Studio, “Remove Unused References” is available. That makes developer jobs much easier than what it is used to be without using some other tools.
Clean up project references and NuGet packages in Visual Studio
Firstly, Right Click on the Project, and select “Remove Unused References”.
This will bring up the “Remove Unused References” Dialog that shows the projects and all unused packages. Here, you can again choose if you want to remove them or keep it as it is.
CI/CD using GitHub Actions Workflow directly from Visual Studio
Did you know – Visual Studio can add Using directive automatically on paste?
Finally, Select “Apply” to remove all the references. Visual Studio will provide you a warning dialog that shows, “This action cannot be undone; do you wish to continue?”
When there is no further unused references, if you select “Remove Unused References” you will have following dialog message.
To summarize, Removing unused references in Visual Studio is a great addition to clean up projects very quickly.
Learn Azure DevOps APIs: Exploring Azure DevOps APIs
Pingback: Dew Drop – May 31, 2021 (#3454) – Morning Dew by Alvin Ashcraft