How do you go about finding unused icons, images, strings in .resx files that may have become 'orphaned' and are no longer required?
This is no information an algorithm can reliably compute. The inspected program could fetch a list of all resources and do something with them, like letting the user choose from several icons.
Your best bet is probably to search for all references to your resource-access API of choice and inspect those manually. Using grep
/sed
you might be able to reduce the sites you have to inspect manually by handling all "easy" ones where a simple string is used.
I've been considering this myself and I believe I have two options. Both of these rely on the fact that I use a helper method to extract the required resource from the resource files.
Logging
Add some code to the "getresource" method or methods so that every time a resource is accessed, the resource key is written to a log. Then try to access every part of the site (a testing script might be helpful here). The resultant log entries should give a list of all the active resource keys, the rest can be junked.Code Analysis
I am looking at whether T4 is capable of working through the solution and creating a list of all references to the "getresource" helper method. The resultant list of keys will be active, the rest can be deleted.
There are limitations of both methods. The logging method is only as good as the code covered by the test and the code analysis might not always find keys rather than strings containg the keys so there will be some extra manual work required there.
I think I'll try both. I'll let you know how it goes.