mercredi 19 avril 2017

Circular Reference in .Net Assemblies

I am trying to find the dependencies for a set of assemblies at runtime and I noticed that my code is implying that System.dll has a circular reference with System.Configuration.dll. I'm assuming that there isn't actually circular reference between these assemblies but can someone explain why I'm seeing the following results from this code?

var systemAssembly = Assembly.ReflectionOnlyLoadFrom("System.dll");
Console.WriteLine(systemAssembly.GetReferencedAssemblies().Select(a => a.FullName));
// Output:
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

var systemConfigurationAssembly = Assembly.ReflectionOnlyLoadFrom("System.Configuration.dll");
Console.WriteLine(systemConfigurationAssembly.GetReferencedAssemblies().Select(a => a.FullName));
// Output:
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Note: Assembly paths have been simplified in my example.





Aucun commentaire:

Enregistrer un commentaire