-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "remove unused references/packages" #6763
Comments
Would this also uninstall corresponding nuget packages? |
Well, as implemented in VS2013 and before it did not, but I think if we were going to bring the feature back we would want it to understand NuGet. |
I am in messy reference hell. This feature is long overdue. |
Currently moving to .netcore3. This would be extremely helpful. Any update? |
Any update on this one? |
Any update? Devs shouldn't have to pay for ReSharper to get this functionality and face the performance hit that entails. This has been open for 5 years. Come on already. |
Is there any update? Is this such a hard thing to develop? |
I totally agree with @TheMrAnderson. Can't wait to hear from @JoeRobich soon. :) |
Well, since everyone is asking about it, this feature is in active development. So far, the Compiler team has completed their necessary work, the Project System team is getting in the last of their changes, and I have begun implementation of the analysis. After that will be UI work to display this information and allow the removal of references. So, we are seeing the light at the end of the tunnel for this feature. |
I am sooo much waiting for this feature as well :) I think of this every day and wish it was already there by now. I have installed Resharper so many times for this specific feature and uninstalled for other performance reasons. |
Any updates in this? Waiting eagerly |
It's still being worked on. |
Hi, thanks for working on the Remove Unused References feature! I used to use it in VB projects all the time and would like very much to see it in C#. I just installed 16.10 Preview 1 and made sure the option to show it is on; however, there is no menu item for this in the Project or References node context menus. This is a .NET Framework 4.8 project. I don't see it in the Project or Dependencies node context menus in a .NET Core 3.1 project either. I changed it to target .NET 5 - still not there. Thanks! |
hope it for multiple targets sdk project. |
Is it possible to remove duplicate dependency packages? |
@mikadumont @JoeRobich Should this be closed now? |
Thanks @jasonmalinowski! Enhancements are being tracked in #50054 |
Sorry, you closed it while I was preparing the comment! Why not wait a day or so for a reply before you close it? |
Hi @JoeRobich, thanks for letting us know of the .NET Framework tracking |
Before VS2015, VB suppported a "Remove unused references" button in it's property pages, but that was never implemented as part of Roslyn.
Reported in http://connect.microsoft.com/VisualStudio/feedback/details/2005014/unused-references-button-missing-from-visual-studio-2015 and internal bug 163717.
User Scenario
Users should be able to
see unused assemblies, packages, and project references
remove unused references
Design
Provide a compiler level API to list used (or the opposite unused) references per compilation #37768 The compiler team will provide an API to list used references in the compilation (or the same: unused references in the compilation). These are individual assembly references.
Provide a map file generation to use for remove unused references functionality sdk#10414 The build team will generate a file with a map of assemblies, packages which can be checked for usage/non-usage. MS Build will generated the file. If other environments are used, they have to provide this file on their own.
Provide project-system API to remove unused references (assemblies, packages) project-system#5258 The project-system team will provide an API for fixing issues.
Implement an analyzer to remove unused references #37769 The IDE team will look for both the compiler API, the file generated and the project-system API, and provide an analyzer with a fixer that will report references which can be removed.
The project-system team will help with driving UI implementation. It can be grey out references with actions in the context menu or a special user control like one described below. This can be decided later based on restrictions found on previous steps.
UX Model
The functionality should be available in the Solution Explorer. In an ideal case, we should grey out unused references directly in the Solution Explorer (dotnet/project-system#76) and add an option in the context menu to remove them. If this is not available e.g. due to performance reasons, please see the UX model below.
Here is the UX model in case if we cannot arrange this directly in the Solution Explorer:
In the Solution Explorer right click on either a project, a solution or the References node of a project.
Have 2 of the following options:
A. Right-click the selection and choose an option to Remove Unused References in the context menu.
B. Or a keyboard shortcut to Remove Unused References.
When selecting Remove Unused References have a dialogue that displays all references that have no actual usages in source code in a tree view grouped by projects. By default, all references are selected for deletion. If necessary, deselect references that you want to keep.
Then select update to remove the unused references/nuget packages.
The text was updated successfully, but these errors were encountered: