Kilo7
Kilo7

Reputation: 31

Finding a symbol in a referenced assembly using Roslyn Code Analysis

I need to search the referenced assemblies of the compilation under analysis for types that have the classname specified, irrespective of the namespace it is within.

Essentially I need a function that searches the referenced assemblies in the same way the below method searches the compilation under analysis.

context.SemanticModel.Compilation.GetSymbolsWithName(classNameToFind, SymbolFilter.Type);

Is there a way to load a compilation abstraction using the assembly name? I am ok with crude ways as long as I do not have to use reflection....so that I can continue to work with ISymbol.

Upvotes: 1

Views: 769

Answers (1)

Jason Malinowski
Jason Malinowski

Reputation: 19021

I don't think we have a special API for this; you can just go to the Compilation's GlobalNamespace and manually walk the namespace/type hierarchy.

Upvotes: 1

Related Questions