Ftp Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
UploadFiles (Required: Host, FileNames Optional: UserName, UserPassword, WorkingDirectory, RemoteDirectoryName, Port)
DownloadFiles (Required: Host Optional: FileNames, UserName, UserPassword, WorkingDirectory, RemoteDirectoryName, Port)
DeleteFiles (Required: Host, FileNames Optional: UserName, UserPassword, WorkingDirectory, RemoteDirectoryName, Port)
DeleteDirectory (Required: HostOptional: UserName, UserPassword, WorkingDirectory, RemoteDirectoryName, Port)
CreateDirectory (Required: HostOptional: UserName, UserPassword, WorkingDirectory, RemoteDirectoryName, Port)
Remote Execution Support: NA
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.CommunicationFtp
Namespace: MSBuild.ExtensionPack.Communication
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The Ftp type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Ftp |
Properties
Name | Description | |
---|---|---|
FileNames |
The list of files that needs to be transfered over FTP
| |
Host |
Sets the Host of the FTP Site.
| |
Overwrite |
Sets if the upload action will overwrite existing files
| |
Port |
The port used to connect to the ftp server.
| |
RemoteDirectoryName |
Sets the Remote Path to connect to the FTP Site
| |
WorkingDirectory |
Sets the working directory on the local machine
|
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> <ftpHost>localhost</ftpHost> </PropertyGroup> <Import Project="$(TPath)"/> <Target Name="Default"> <ItemGroup> <!-- Specify FilesToUpload --> <FilesToUpload Include="C:\demo.txt" /> <FilesToUpload Include="C:\demo2.txt" /> </ItemGroup> <MSBuild.ExtensionPack.Communication.Ftp TaskAction="UploadFiles" Host="$(ftpHost)" FileNames="@(FilesToUpload)"/> <ItemGroup> <!-- Specify the files to Download--> <FilesToDownload Include="demo2.txt" /> <FilesToDownload Include="demo.txt" /> </ItemGroup> <MSBuild.ExtensionPack.Communication.Ftp TaskAction="DownloadFiles" Host="$(ftpHost)" FileNames="@(FilesToDownload)" WorkingDirectory="C:\FtpWorkingFolder"/> <MSBuild.ExtensionPack.Communication.Ftp TaskAction="CreateDirectory" Host="$(ftpHost)" RemoteDirectoryName="NewFolder1"/> <MSBuild.ExtensionPack.Communication.Ftp TaskAction="CreateDirectory" Host="$(ftpHost)" RemoteDirectoryName="NewFolder2"/> <MSBuild.ExtensionPack.Communication.Ftp TaskAction="DeleteDirectory" Host="$(ftpHost)" RemoteDirectoryName="NewFolder1"/> <MSBuild.ExtensionPack.Communication.Ftp TaskAction="DeleteFiles" Host="$(ftpHost)" FileNames="@(FilesToDownload)" /> </Target> </Project>
See Also