Open citizenmatt opened 12 years ago
What's the first place to look for this?
There are several entry points. Fire up dotPeek, and look for:
Then it will be a matter of legwork - follow the code to see where it goes, and what it's looking for, and how we can hook into it. If I remember rightly, ReSharper is trying to get all references to types that exist in the known references. If it finds them, they're in use, and can be removed. If it doesn't, then it flags the reference as something that can be removed.
I haven't really looked into how we can get this working yet, but there are lots of things we can do - if ReSharper is looking for references, can we add a reference to nuget assemblies? What would that give us? Or can we hook assembly removal, so at the least, can we call package uninstall when an assembly is removed? Or perhaps we can add a group into the analyse references window that shows what assemblies are nuget packages, so even if ReSharper can't tell us if a package should be removed or not, at least we're showing the user that these are packages. Or something else - ReSharper has LOTS of extensibility points.
Basically, I'm saying I don't know how to do this, but there's always options :smile:
+1
You can use ReferencedCodeSearcher solution component. This is the core engine for 'optimize references', 'find dependent code' and some other features. In a couple of words, this engine asynchronously, in multiple threads, searches for references inside the given scope to the given targets.
+1
Not having this makes the "Remove Unused References" pretty useless in any project these days, as almost all projects have at least one NuGet reference and most have a ton. So a big :+1: from me!
Is this possble?