Hi,

this is somewhat offtopic here on nant users list.
But since I did this before I will show you a possible solution


Am 30.08.2010 16:55, schrieb Pento, Michael:
> 
> 
> I am trying to loop through a directory filled with about 2,000 DLL’s
> and EXE’s to see which ones are .NET assemblies.
> 
> Is there a way that I can use from an automation perspective to do this?
> 

I used Mono.Cecil for some reference retreival and needed to skip non
.Net assemblies.

private bool IsNetAssembly(string fileName) {
    Mono.Cecil.Binary.Image img;
    img = Mono.Cecil.Binary.Image.GetImage(fileName);

    if ((img.CLIHeader == null)) {
        return false;
    }
    return true;
}
Hint: This code is using Mono.Cecil 0.6. If you use Mono.Ccil 0.9x then
Mono.Cecil.PE.Image should be used instead of Mono.Cecil.Binary.Image

hth

Dominik

-- 
The answer to the great question of life,
the universe and everything is 42 (Douglas Adams)

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to