是我自己的问题还是这个项目文档真的很少?
我正在尝试查找如何使用FtpCreateRemoteDirectory和FTP功能,但似乎找不到任何内容。
谷歌搜索FtpCreateRemoteDirectory,只显示项目的源代码...
是我自己的问题还是这个项目文档真的很少?
我正在尝试查找如何使用FtpCreateRemoteDirectory和FTP功能,但似乎找不到任何内容。
谷歌搜索FtpCreateRemoteDirectory,只显示项目的源代码...
文档确实像你所说的那样非常缺乏。
我发现最好的方法是在这里下载最新的源代码:https://github.com/loresoft/msbuildtasks
最新的文档也可以直接通过 GitHub 查看,而不需要下载源代码:https://github.com/loresoft/msbuildtasks/tree/master/Documentation
如果您使用 MSI 安装了该工具集,则还可以查看安装文件夹中的 XSD 文件(C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.xsd),至少可以看到可用的任务以及与之相关的文档信息。
安装类似于Jetbrains dotPeek(或其他免费的.NET Reflector副本)的.NET反编译器。
PM> Install-Package MSBuildTasks
(从VS) 或
> nuget install MSBuildTasks
(从命令行)
在上述提到的dotPeek中打开slnDir\.build\MSBuild.Community.Tasks.dll
,导航到命名空间MSBuild.Community.Tasks
并双击您感兴趣的任务。
收益!
我在查找同样的信息时发现了这个,所以可以提供一个完整的MSBuild目标的例子,它创建一个FTP文件夹,然后将内容复制到新位置。请注意,此示例上传到安全站点,因此您可能需要更改端口号以适应您的情况。
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<Target Name="MSBuildFTP">
<PropertyGroup>
<ftpHost>Your Host</ftpHost>
<ftpUser>Your username</ftpUser>
<ftpPass>you guessed it.. your password</ftpPass>
</PropertyGroup>
<Message Text="Create the directory if it does not exist - FtpUploadDirectoryContent fails if the dir does not exist" />
<FtpCreateRemoteDirectory
ServerHost="$(ftpHost)"
Port="21"
Username="$(ftpUser)"
Password="$(ftpPass)"
RemoteDirectory="SSL/secure/"
/>
<Message Text="Copy the contents of our directory to the ftp location" />
<FtpUploadDirectoryContent
ServerHost="$(ftpHost)"
Port="21"
Username="$(ftpUser)"
Password="$(ftpPass)"
LocalDirectory="deployment"
RemoteDirectory="SSL/secure"
Recursive="false"
/>
</Target>
</Project>
您可以使用XSD检查可用选项。
干杯。