Thoughts on Change Framework Command

by Jason Haley 1. August 2010 08:17

Yesterday on Stack Overflow, someone requested the ability to change the framework files that Reflector uses without having to create a new list.  Personally, I think that scenario is a great use of lists, but anyway – I thought it would be a nice challenge to add a command to the powercommands project to do this. This entry is just my thoughts on how I can accomplish this … hopefully I’ll take the time this week and implement them.

Link to the Stack Overflow item: How to have reflector load a different framework on load

The desired use case:

  1. you have all the assemblies loaded in your tree doing your normal reflector thing
  2. you decide, hey I want to change the framework to use version x
  3. you click tools menu -> change framework
  4. a dialog pops up that asks you which to choose (will look like the reflector one but will have to be a custom one)
  5. you choose the framework version
  6. the assembly tree then gets any of the default framework assemblies you had in the tree, removed and repopulated with the new framework version assemblies AND the other assemblies you had in the tree as well

After spending some time poking around with Reflector and its in memory objects while debugging and looking at the cfg file, it looks like this is totally doable … should be something like this:

  1. Load the AssemblyCache directories and write some logic to discover the proper clr versions
  2. Create a dialog to mimic the Reflector dialog to choose the framework
  3. Once the user selects a framework to change to, grab a list of the assemblies loaded that have a location within the assembly cache directories and remove those from the AssemblyManager Assemblies collection
  4. Go through the listing that was removed and attempt to locate a version in the new framework (note: there isn’t a 1 to 1 match on assemblies here so some will not be found), Load the files into the AssemblyManager as they are found
  5. Run the Order Assemblies command logic over the assemblies once complete (assemblies loaded are always added to the end, so will need to reorder).

I’m guessing #1 will take the longest – writing the logic to locate the proper clr versions and the probing locations for the dlls.

Maybe later on I’ll add a checkbox to the dialog to have it create a list … that way you could go back and forth without loosing any dlls … which makes me think I should probably save the original listing so it could be restored if you choose the original framework version after changing to an older one that didn’t have all the dlls … food for thought.

Comments (0) | Post RSSRSS comment feed |

Categories:
Tags:

Comments

Comments are closed