Share Class

MSBuild Extension Pack

Share Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

CheckExists (Required: ShareName Output: Exists)

Create (Required: ShareName, SharePath Optional: Description, MaximumAllowed, CreateSharePath, AllowUsers, DenyUsers)

Delete (Required: ShareName)

ModifyPermissions (Required: ShareName Optional: AllowUsers, DenyUsers).

SetPermissions (Required: ShareName Optional: AllowUsers, DenyUsers). SetPermissions will reset all existing permissions.

Remote Execution Support: Yes

Inheritance Hierarchy

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

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

The Share type exposes the following members.

Constructors

  NameDescription
Public methodShare
Top
Properties

  NameDescription
Public propertyAllowUsers
Sets a collection of users allowed to access the share. Use the Permission metadata tag to specify permissions. Default is Full.

<Allow Include="AUser">
    <Permission>Full, Read or Change etc</Permission>
</Allow>

Public propertyCreateSharePath
Sets whether to create the SharePath if it doesnt exist. Default is false
Public propertyDenyUsers
Sets a collection of users not allowed to access the share
Public propertyDescription
Sets the desctiption for the share
Public propertyExists
Gets whether the share exists
Public propertyMaximumAllowed
Sets the maximum number of allowed users for the share
Public propertyShareName
Sets the share name
Public propertySharePath
Sets the share path
Top
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>
            <Allow Include="ADomain\ADomainUser"/>
            <Allow Include="AMachine\ALocalReadUser">
                <Permission>Read</Permission>
            </Allow>
            <Allow Include="AMachine\ALocalChangeUser">
                <Permission>Change</Permission>
            </Allow>
        </ItemGroup>
        <!-- Delete shares -->
        <MSBuild.ExtensionPack.FileSystem.Share TaskAction="Delete" ShareName="MSBEPS1"/>
        <MSBuild.ExtensionPack.FileSystem.Share TaskAction="Delete" ShareName="MSBEPS2"/>
        <!-- Create a share and specify users. The share path will be created if it doesnt exist. -->
        <MSBuild.ExtensionPack.FileSystem.Share TaskAction="Create" AllowUsers="@(Allow)" CreateSharePath="true" SharePath="C:\fff1" ShareName="MSBEPS1" Description="A Description of MSBEPS1"/>
        <!-- Create a share. Defaults to full permission for Everyone. -->
        <MSBuild.ExtensionPack.FileSystem.Share TaskAction="Create" SharePath="C:\fffd" ShareName="MSBEPS2" Description="A Description of MSBEPS2"/>
        <!-- Create a share on a remote server -->
        <MSBuild.ExtensionPack.FileSystem.Share TaskAction="Create" AllowUsers="@(Allow)" CreateSharePath="true" MachineName="MyFileShareServer" ShareName="Temp" SharePath="D:\Temp" Description="Folder for shared files used." />
    </Target>
</Project>
See Also

Reference