Have a rather large project with nearly a dozen assemblies added to the shell and other assemblies added via config
Trying to find a better way to add assemblies referenced in the project
The code so far looks like this
Dictionary<string,string> dict = new Dictionary<string,string>(); // to avoid duplicate parts
foreach (Assembly an in AppDomain.CurrentDomain.GetAssemblies())
addAssembly(an, dict);
foreach (AssemblyName an in Assembly.GetEntryAssembly().GetReferencedAssemblies())
addAssembly(an, dict);
foreach (AssemblyName an in GetAsmInConfig())
addAssembly(an, dict);
Even so, not all assemblies referenced at design time to Shell are added to the catalog
Wondering if there’s anything short of adding all assemblies to config that will do the trick
UPDATE
void addAssembly(Assembly a, Dictionary<string, string> dict)
{
if (a.IsDynamic || dict.ContainsKey(a.FullName))
return;
dict.Add(a.FullName, a.FullName);
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(a));
}
the compiler will remove refferences to that are not actually used so you can not rely on this as a mechanism to enumerate assemblies.
Your options are to: