James Ko
James Ko

Reputation: 34529

How to get all assembly references using Mono.Cecil?

I'm using Mono.Cecil to inspect a portable class library I've built. I'm wondering how to get all of the referenced assemblies after I read the DLL in, much like how ILSpy does it. Can anyone help? Here is the code I have so far:

var module = ModuleDefinition.ReadModule(assemblyPath);

// No `References` or `GetReferences()` property on the
// resulting object, so I'm confused about what to do here

Upvotes: 1

Views: 2468

Answers (1)

James Ko
James Ko

Reputation: 34529

Never mind, I'm blind. You can do this via the AssemblyReferences property:

var references = module.AssemblyReferences;

Upvotes: 4

Related Questions