Hi there,
System.Reflection
is your friend here. This is how you get the referenced assemblies in run-time.
StringBuilder builder = new StringBuilder();
Assembly currentAssembly = Assembly.GetExecutingAssembly();
AssemblyName[] referencedAssemblies = currentAssembly.GetReferencedAssemblies();
foreach (AssemblyName assembly in referencedAssemblies)
{
builder.AppendLine(assembly.FullName);
}
MessageBox.Show(builder.ToString());
One thing to note here is that, this list
may not be exactly equal to the the list of references in the Solution Explorer of VS. There are numerous reasons for this, but the main reason is that, even though you add references to a project, they won't be used in your code. Those assemblies will not be referenced or loaded in run time, hence they won't be listed.
Hope this helps :) Regards