Get Application reference assembly at runtime

  • Thread starter Thread starter Serge calderara
  • Start date Start date
S

Serge calderara

Dear all,

Is there a way to get the list of references attached to
my application by code?

The idea is that when my application start, I would like
to log in a file the version of all assembly used.

thanks for your answer
regards
 
Serge calderara said:
Is there a way to get the list of references attached to
my application by code?

The idea is that when my application start, I would like
to log in a file the version of all assembly used.

Well, you can find out all the assemblies which are loaded in a
particular AppDomain using AppDomain.GetAssemblies. However, if your
app only uses some of the assemblies that it references later on, those
assemblies won't have been loaded into the AppDomain.

You *could* find your executable file and read which assemblies it
references, but that would be a bit of a pain.

You could also hook into AppDomain.AssemblyLoad and log the version
loaded when each assembly loads - but again, that wouldn't get you
everything right at the start.
 
Back
Top