使用msbuild FtpUploadDirectoryContent时,目录名无效

使用msbuild FtpUploadDirectoryContent时,目录名无效,msbuild,msbuildcommunitytasks,Msbuild,Msbuildcommunitytasks,我正在处理msbuild脚本并获得以下错误消息 The "FtpUploadDirectoryContent" task failed unexpectedly. error MSB4018: System.IO.IOException: The directory name is invalid. 我的脚本是 <FtpUploadDirectoryContent ServerHost="$(ftpHost)" Port="21" Use

我正在处理msbuild脚本并获得以下错误消息

 The "FtpUploadDirectoryContent" task failed unexpectedly.
error MSB4018: System.IO.IOException: The directory name is invalid.
我的脚本是

<FtpUploadDirectoryContent
        ServerHost="$(ftpHost)"
        Port="21"
        Username="$(ftpUser)"
        Password="$(ftpPass)"
        LocalDirectory="E:\demo\test.txt"
        RemoteDirectory="website/config"
        Recursive="true"
        />


我的IIS托管路径是C:\inetpub\wwwroot,并且[C:\inetpub\wwwroot\website\config]中存在website\config文件夹。但我仍然收到这样的消息:目录名无效。。请告诉我如何解决此问题。此问题的合适systax是什么..请建议是否需要任何其他东西

LocalDirectory=“E:\demo\test.txt”

你给了它一个文件名,而不是目录

E:\demo\test.txt是一个文件名

这是来自的代码

所以你要做的基本上是:

 Directory.GetFiles( "E:\demo\test.txt" , "*.* ))
这是行不通的

将其更改为:

LocalDirectory="E:\demo\"
上面github链接中的示例代码

/// <Target Name="DeployWebsite">
/// <FtpUploadDirectoryContent
/// ServerHost="ftp.myserver.com"
/// Port="42"
/// Username="user"
/// Password="p@ssw0rd"
/// LocalDirectory="c:\build\mywebsite"
/// RemoteDirectory="root\www\mywebsite"
/// Recursive="true"
/// />

MSBuild的FtpTask需要.NET 2.0。

我没听懂你的意思?你能解释一下吗?那么FtpUploadDirectoryContent中的LocalDirectory和RemoteDirectory呢。我想知道如何设置路径。我会使用Filezilla这样的程序来确保FTP正常工作,~然后将参数移动到任务中。非常感谢。现在我知道了…它正在工作。但我想问一下,文件夹中是否有多个文件,只需要传输很少的文件,然后如何设置路径?但我有个问题,我只希望必须传输选定的文件。在您的解决方案中,“c:\build\mywebsite”中的任何文件都将被传输。所以我的问题是如何只传输特定的文件
/// <Target Name="DeployWebsite">
/// <FtpUploadDirectoryContent
/// ServerHost="ftp.myserver.com"
/// Port="42"
/// Username="user"
/// Password="p@ssw0rd"
/// LocalDirectory="c:\build\mywebsite"
/// RemoteDirectory="root\www\mywebsite"
/// Recursive="true"
/// />
**Upload, download or delete a single file on a FTP server** 
Recursively upload, download or delete a directory
Use multiple FTP connections simultaneously