Question

I use Antlr tools as follows (on Mono)

dmcs  /r:Antlr3.Runtime.dll /r:StringTemplate.dll *.cs /out:Main.exe

I reference two dll's, but there is another dll file (antlr.runtime.dll) that is referenced behind the scene. I got this when I have an error just copying two dlls and compile.

Are there any .NET tools to detect what dll's are referenced? For example, if I run 'DETECT Antlr3.Runtime.dll', I get 'antlr.runtime.dll'.

Was it helpful?

Solution

You could use Reflector or write one using Mono.Cecil (NDepend use this)

Example using Mono.Cecil

In a new project, reference Mono.Cecil

using System;
using Mono.Cecil;

namespace ReferenceDetector
{
  class Program
  {
    static void Main(string[] args)
    {
      var assemblyPath = args[0];
      var assemblyDefinition = AssemblyFactory.GetAssembly(assemblyPath);
      Console.WriteLine(assemblyDefinition.Name.FullName);
      foreach (AssemblyNameReference reference in assemblyDefinition.MainModule.AssemblyReferences)
      {
        Console.WriteLine("\t" + reference.FullName);
      }
    }
  }
}

OTHER TIPS

Give NDepend a go. It has a dependency graph/dependency matrix feature that lets you explore dependencies between DLLs.

You can use Reflector. (Recursively expand the References node)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top