Valid TaskActions are:

AddSecurity (Required: Path, Users Optional: AccessType, Permission)

DeleteAll (Required: Path, Match)

Get (Required: Path Optional: Match, Recursive)

Move (Required: Path, TargetPath)

RemoveContent (Required: Path Optional: Force, RetryCount)

RemoveSecurity (Required: Path, Users Optional: AccessType)

Remote Execution Support: No

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

Examples

Xml Copy imageCopy
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <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="Default">
        <ItemGroup>
            <Users Include="AReadUser">
                <Permission>ExecuteFile, Read</Permission>
            </Users>
            <Users Include="AChangeUser">
                <Permission>FullControl</Permission>
            </Users>
            <FoldersToPermission Include="c:\az">
                <Account>Performance Log Users</Account>
                <Permission>Read,Write,Modify,Delete</Permission>
                <AccessType>Allow</AccessType>
            </FoldersToPermission>
            <FoldersToPermission Include="c:\az">
                <Account>AChangeUser</Account>
                <Permission>Read,Write,Modify,Delete</Permission>
                <AccessType>Allow</AccessType>
            </FoldersToPermission>
            <FoldersToRemovePermissions Include="c:\az">
                <Account>Performance Log Users</Account>
                <Permission>Read,Write,Modify,Delete</Permission>
            </FoldersToRemovePermissions>
        </ItemGroup>
        <Microsoft.Build.Tasks.MakeDir Directories="c:\Demo2;c:\Demo1;c:\ddd"/>
        <Microsoft.Build.Tasks.RemoveDir Directories="C:\adeeeee"/>
        <!-- Add security for users -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="AddSecurity" Path="c:\Demo2" Users="@(Users)"/>
        <!-- Remove security for users -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="RemoveSecurity" Path="c:\Demo2" Users="@(Users)"/>
        <!-- Add Deny security for users -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="AddSecurity" AccessType="Deny" Path="c:\Demo2" Users="@(Users)"/>
        <!-- Remove Deny security for users -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="RemoveSecurity" AccessType="Deny" Path="c:\Demo2" Users="@(Users)"/>
        <!-- Delete all folders matching a given name -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="DeleteAll" Path="c:\Demo2" Match="_svn"/>
        <!-- Remove all content from a folder whilst maintaining the target folder -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="RemoveContent" Path="c:\Demo"/>
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="AddSecurity" AccessType="%(FoldersToPermission.AccessType)" Path="%(FoldersToPermission.Identity)" Users="%(FoldersToPermission.Account)" Permission="%(FoldersToPermission.Permission)"/>
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="RemoveSecurity" AccessType="%(FoldersToRemovePermissions.AccessType)" Path="%(FoldersToRemovePermissions.Identity)" Users="%(FoldersToRemovePermissions.Account)" Permission="%(FoldersToRemovePermissions.Permission)"/>
        <!-- Move a folder -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="Move" Path="c:\Demo1" TargetPath="C:\adeeeee"/>
        <!-- Lets copy a selection of folders to multiple locations -->
        <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="Get" Path="c:\ddd">
            <Output TaskParameter="Folders" ItemName="FoundFolders"/>
        </MSBuild.ExtensionPack.FileSystem.Folder>
        <Message Text="%(FoundFolders.Identity)"/>
        <ItemGroup>
            <MyWebService Include="C:\a\Dist\**\*.*">
                <ToDir>%(FoundFolders.Identity)</ToDir>
            </MyWebService>
        </ItemGroup>
        <!-- Copy using the metadata -->
        <Copy SourceFiles="@(MyWebService)" DestinationFolder="%(ToDir)\%(RecursiveDir)" />
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    MSBuild.ExtensionPack..::..BaseTask
      MSBuild.ExtensionPack.FileSystem..::..Folder

See Also