Assembly.GetReferencedAssemblies doesn't return all ref'd assemblies

  • Thread starter Thread starter Mike V
  • Start date Start date
M

Mike V

Why is it that the Assembly.GetReferencedAssemblies method returns an array
containing *some* of the referenced Assemblies, but not others? I have code
that depends on this functionality actually working. For example, I have a
CustomAssemblyA that references a CustomAssemblyB within Visual Studio, but
it doesn't show up as a reference when I call
CustomAssemblyA.GetReferencedAssemblies().

What do I need to do to get it to show up in the list?

Thanks,
Mike
 
Mike V said:
Why is it that the Assembly.GetReferencedAssemblies method returns an array
containing *some* of the referenced Assemblies, but not others? I have code
that depends on this functionality actually working. For example, I have a
CustomAssemblyA that references a CustomAssemblyB within Visual Studio, but
it doesn't show up as a reference when I call
CustomAssemblyA.GetReferencedAssemblies().

What do I need to do to get it to show up in the list?

If you have a look at CustomAssemblyA in ILDASM, and look at the
manifest and the .assembly sections, does that show a reference to
CustomAssemblyB?
 
I just fixed the problem, actually. I had to actually create a dummy object
of type CustomAssemblyB from within CustomAssemblyA in order to get it to
show up as a reference. (So now it's showing up in the manifest, to answer
your question.)

You might be wondering why I needed it if I never had a reference to it in
CustomAssemblyA. It's because I passed pointers to delegates defined in
CustomAssemblyB to CustomAssemblyB. That wasn't enough to get the manifest
to generate a reference to CustomAssemblyB though, I guess.

Thanks for your help!
Mike
 
Back
Top