Hi Dominik,

I thought that it might be a bit outside of focus, but, I was taking a gamble 
that someone knew something about nant that I haven't learned over the past 5 
or 6 years.

Thanks very much for the suggested solution, I will try that immediately and 
let you know how I make out.

Thanks again,
Mike

-----Original Message-----
From: Dominik Guder [mailto:o...@guder.org] 
Sent: Tuesday, August 31, 2010 5:20 PM
To: nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] Determining whether a file is a .NET assembly or not

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


------------------------------------------------------------------------------
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