Stephen, 

Here's a quick example.

<project name="foreach.example" default="build" basedir=".">
   <fileset id="projects">
        <include name="C:\temp\Project1.csproj" />
        <include name="C:\temp\Project2.csproj" />
   </fileset>
   
   <target name="build" >
        <foreach item="File" property="vsnet.project">
         <in>
                <items refid="projects" />
         </in>
         <do>
                <echo message="${vsnet.project}" />
          </do>
        </foreach>
   </target>
</project>

Regards, 
Craig
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:nant-users-
> [EMAIL PROTECTED] On Behalf Of Stephen Lewis
> Sent: Thursday, July 14, 2005 9:26 AM
> To: nant-users@lists.sourceforge.net
> Subject: [Nant-users] using foreach with a fileset
> 
> I'd like to be able to generate a list of files in the form of a file
> set, and then perform several sets of operations on the file set.
> 
> I thought I'd start with something simple to verify the files in the
> file set, like iterate through the list and print the name of each
file.
> 
> According to the help for <foreach>, it can iterate over a fileset by
> specifying it in the <in> parameter.  Can someone provide a short
> example of how to do this.
> 
> Here is an example that DOES  NOT work!
> <fileset id="testresults.set" basedir="${outputdir}">
>       <include name=ncover-*.xml"/>
> </fileset>
> 
> <foreach item="File" property="filename">
>       <in>
>               <fileset refid="testresult.set"/>  <-- error here
>       </in>
>       <do>
>               <echo message=${filename}"/>
>       </do>
> </foreach>
> 
> Are there any properties for filesets, like the number of items in the
> set?
> 
> Stephen Lewis
> Envisioneering LLC - Medical Products
> St. Louis, MO 63114
> (314) 429-7367 x112
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> _______________________________________________
> Nant-users mailing list
> Nant-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users

Attachment: foreach.build
Description: foreach.build

Reply via email to