reading manifest

A

Ahmet AKGUN

Hi;

Can we get all dependincy information (manifest) of an executableusing c# ?
If so, can anybody give a small example ?

thanks..
 
K

Kevin McNeish [C# MVP]

Can we get all dependincy information (manifest) of an executableusing c# ?
If so, can anybody give a small example ?

You can, by means of the Assembly class's GetReferencedAssemblies method.
For example:

Assembly MyAssembly = Assembly.LoadFrom("c:\\MyAssembly.dll");
AssemblyName[] AsmNames = Assembly.GetReferencedAssemblies();

You can also get a reference to the currently executing assembly like this:

Assembly CurrentAssembly = Assembly.GetExecutingAssembly();

Regards,
Kevin McNeish
C# MVP
Chief Software Architect, Mere Mortals .NET Framework
www.oakleafsd.com
 
A

Ahmet AKGUN

thanks it workes, but how can I dismiss System.Forms like dependincies ?
I just want to external referenced dll's that users prepared and their
version

But all System.* referances are also in this list.

thanks..



Kevin McNeish said:
Can we get all dependincy information (manifest) of an executableusing
c#
?
If so, can anybody give a small example ?

You can, by means of the Assembly class's GetReferencedAssemblies method.
For example:

Assembly MyAssembly = Assembly.LoadFrom("c:\\MyAssembly.dll");
AssemblyName[] AsmNames = Assembly.GetReferencedAssemblies();

You can also get a reference to the currently executing assembly like this:

Assembly CurrentAssembly = Assembly.GetExecutingAssembly();

Regards,
Kevin McNeish
C# MVP
Chief Software Architect, Mere Mortals .NET Framework
www.oakleafsd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top