Folder Class | MSBuild Extension Pack Help 4.0.12.0 |
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
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.FileSystemFolder
Namespace: MSBuild.ExtensionPack.FileSystem
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The Folder type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Folder |
Properties
Name | Description | |
---|---|---|
AccessType |
Set the AccessType. Can be Allow or Deny. Default is Allow.
| |
Folders |
Gets the folder list
| |
Force |
Sets a value indicating whether to delete readonly files when performing RemoveContent
| |
Match |
Sets the regular expression to match in the name of a folder for Delete. Case is ignored.
| |
Path |
Sets the path to remove content from, or the base path for Delete
| |
Permission |
A comma-separated list of FileSystemRights.
| |
Recursive |
Set to true to perform a recursive scan. Default is false.
| |
RetryCount |
Sets a value indicating how many times to retry removing the content, e.g. if files are temporarily locked. Default is 5. The retry occurs every 5 seconds.
| |
TargetPath |
Sets the TargetPath for a renamed folder
| |
Users |
Sets the users collection. Use the Permission metadata tag to specify permissions. Separate pemissions with a comma.
Read,etc |
Examples
<Project ToolsVersion="4.0" 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>
See Also