
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Listing Referenced Assemblies
|
755
This code returns a string[] containing the original assembly, all imported assem-
blies, and the dependent assemblies of the imported assemblies.
If you ran this method against the assembly C:\CSharpRecipes\bin\Debug\CSharpRecipes.
exe, you’d get the following dependency tree:
C:\CSharpRecipes\bin\Debug\CSharpRecipes.exe
mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Configuration, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
System.Xml, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Security, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Web.RegularExpressions, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Serialization.Formatters.Soap, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
Discussion
Obtaining the imported types in an assembly is useful in determining what assem-
blies another assembly is using. This knowledge can greatly aid in learning to use a
new assembly. This method can also help determine dependencies between assem-
blies for shipping purposes.
The
GetReferencedAssemblies method