How can I quickly find, given a folder with .Net assemblies, which of these depends on some given assembly?
(Opening them up one by one with Reflector is not what I had in mind)
You can do it in code using GetReferencedAssemblies()
method of assembly:
public void GetDependentAssemblies(Assembly assembly)
{
var assembliesPaths = new[] {
@"c:\dlls\assembly1.dll",
@"c:\dlls\assembly2.dll"
};
IEnumerable<Assembly> dependantAssemblies = assembliesPaths
.Select(path => Assembly.ReflectionOnlyLoadFrom(path))
.Where(folderAssembly =>
{
var fullNames = folderAssembly.GetReferencedAssemblies()
.Select(name => name.FullName);
return fullNames.Contains(assembly.GetName().FullName);
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With