Monday, August 29, 2011

Depends4Net - Dependency Walker homage project... (or A kind of Dependency Walker for .Net, with source...)

CodeProject - Depends4Net - Part 1

"I’ve been looking for something like “Dependency Walker” for a while – something that simple to deploy. Currently Depends4Net allows me to view a tree of all dependent assemblies – even those not present on the system, or otherwise inaccessible to the rather simple assembly resolver currently implemented, in a manner similar to “Dependency Walker”.

Depends4NetFound600

While far from production quality, it’s still a useful little tool that allows me to figure out which assemblies are missing from a given installation. The code depends on the WPF Toolkit, included with Visual Studio 2010, and does not require any other framework to build. You can easily use this code to create a command line utility requiring nothing but a working .Net 4 installation.

To keep things interesting I load the assemblies into a separate application domain, and this presents us with a few challenges. As the .Net Assembly class is [Serializable], accessing the assembly directly would actually load the assembly into the current domain, and hence defeat the whole purpose of creating a separate domain, so another type must be used to transfer information about the loaded assemblies back to the primary AppDomain. A bit of testing also seems to indicate that this gives us the correct version the .Net framework libraries.

The class responsible for loading the assemblies is part of the primary assembly for the application, and as I really want to be able to load assemblies from any location, this requires a little trick. image

Ah... Dependency Walker. That brings back some memories (mostly bad ones of trying to figure out why the heck a given install wasn't work right...). I can use a .Net version of it from time to time, that's sure...

(via Jason Haley - Interesting Finds: August 29, 2011 )

 

Related Past Post XRef:
Dependency Walker (depends.exe) Home Page

No comments: