FindUnder Class

MSBuild Extension Pack

FindUnder Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

FindFiles (Required: Path Optional: ModifiedAfterDate, ModifiedBeforeDate, Recursive, SearchPattern Output: FoundItems)

FindDirectories (Required: Path Optional: ModifiedAfterDate, ModifiedBeforeDate, Recursive, SearchPattern Output: FoundItems)

FindFilesAndDirectories (Required: Path Optional: ModifiedAfterDate, ModifiedBeforeDate, Recursive, SearchPattern Output: FoundItems)

Remote Execution Support: NA

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.FileSystemFindUnder

Namespace: MSBuild.ExtensionPack.FileSystem
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The FindUnder type exposes the following members.

Constructors

  NameDescription
Public methodFindUnder
Top
Properties

  NameDescription
Public propertyFoundItems
The list of items (files and or directories) which were found.
Public propertyModifiedAfterDate
Set this value to only return files or folders modified after the given value
Public propertyModifiedBeforeDate
Set this value to only return files or folders modified before the given value
Public propertyPath
The path that the FindUnder will be executed against. This is a Required value.
Public propertyRecursive
Sets whether the File search is recursive. Default is true
Public propertySearchPattern
This in an optional input property. This will set the SearchPattern to be used in the search.
The default value for this is "*";
This value is passed to either the System.IO.DirectoryInfo.GetDirectories method and/or the System.IO.FileInfo.GetFiles method. See that documentation for usage guidlines.
Top
Examples

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Demo">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Demo">
        <!-- Only finds files -->
        <MSBuild.ExtensionPack.FileSystem.FindUnder TaskAction="FindFiles" Path="$(MSBuildProjectDirectory)">
            <Output ItemName="AllFoundFiles" TaskParameter="FoundItems"/>
        </MSBuild.ExtensionPack.FileSystem.FindUnder>
        <Message Text="===== Found Files =====" Importance="high"/>
        <Message Text="AllFoundFiles:%0d%0a@(AllFoundFiles,'%0d%0a')"/>
        <!-- Only finds directories -->
        <MSBuild.ExtensionPack.FileSystem.FindUnder TaskAction="FindDirectories" Path="$(MSBuildProjectDirectory)\..\">
            <Output ItemName="AllFoundDirectories" TaskParameter="FoundItems"/>
        </MSBuild.ExtensionPack.FileSystem.FindUnder>
        <Message Text="===== Found Directories =====" Importance="high"/>
        <Message Text="AllFoundDirectories:%0d%0a@(AllFoundDirectories,'%0d%0a')"/>
        <!-- Find both files and directories -->
        <MSBuild.ExtensionPack.FileSystem.FindUnder TaskAction="FindFilesAndDirectories" Path="$(MSBuildProjectDirectory)\..\">
            <Output ItemName="AllFoundItems" TaskParameter="FoundItems"/>
        </MSBuild.ExtensionPack.FileSystem.FindUnder>
        <Message Text="===== Found Files and Directories =====" Importance="high"/>
        <Message Text="AllFoundItems:%0d%0a@(AllFoundItems,'%0d%0a')"/>
        <!-- Find both files with SearchPattern = "F*" -->
        <MSBuild.ExtensionPack.FileSystem.FindUnder TaskAction="FindFiles" Path="$(MSBuildProjectDirectory)\..\" SearchPattern="F*">
            <Output ItemName="AllFilesStartingWithF" TaskParameter="FoundItems"/>
        </MSBuild.ExtensionPack.FileSystem.FindUnder>
        <Message Text="===== Found Files Starting with 'F' =====" Importance="high"/>
        <Message Text="AllFilesStartingWithF:%0d%0a@(AllFilesStartingWithF,'%0d%0a')"/>
    </Target>
</Project>
See Also

Reference