Get exported semantic model for MetadataReference
问题 Is it possible to get a collection of ITypeSymbol's for the types exported by an assembly that's been added to a compilation as a MetadataReference? I want to inspect the types available to the referencing project. 回答1: Call Compilation.GetAssemblyOrModuleSymbol() for each MetadataReference, cast to IAssemblySymbol , then look at the TypeNames property (which returns strings). To get the actual ITypeSymbol s for each type, fetch the assembly's GlobalNamespace , then recursively crawl through