I'm interested in using Cecil to generate a dependency graph. I found this 
excellent Stack Overflow answer, but it uses an unstated older version of 
Cecil:

http://stackoverflow.com/a/9263183/3589542

public static void PoC(IEnumerable<AssemblyDefinition> assemblies, TextWriter 
writer){
    Console.WriteLine("digraph Dependencies {");
    var loaded = assemblies
        .SelectMany(a => a.Modules.Cast<ModuleDefinition>())
        .SelectMany(m => 
m.AssemblyReferences.Cast<AssemblyNameReference>().Select(a => a.Name + ".dll"))
        .Distinct()
        .Select(dllname => {
               try { return AssemblyFactory.GetAssembly(dllname); }
               catch { return null; } })
        .Where(assembly => assembly != null)
        .ToList();

    loaded.ForEach(a => a.MainModule.FullLoad());

    loaded.ForEach(a =>
        {
            foreach (var r in 
a.MainModule.AssemblyReferences.Cast<AssemblyNameReference>())
                Console.WriteLine(@"""{0}"" -> ""{1}"";", r.Name, a.Name.Name);
        } );

    Console.WriteLine("}");}


Could anyone please advise how I can migrate this to the current version? 
I've looked at the migration guide and made the obvious changes, but I am 
having trouble tracking down what happened to ModuleDefinition.FullLoad()

Thanks,
Chris

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to