问题
Is it just me or is the documentation on this project really scarce?
I'm trying to find how to use the FtpCreateRemoteDirectory and FTP functionality in general, but can't seem to find anything.
Googling FtpCreateRemoteDirectory, only shows the project's source code...
回答1:
The documentation is like you say really scarce. The best I found is to download the latest source code here : https://github.com/loresoft/msbuildtasks
The latest documentation can also be viewed via GitHub directly without downloading the source: https://github.com/loresoft/msbuildtasks/tree/master/Documentation
If installed using the MSI, you can also look at the XSD found in the installation folder (C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.xsd) to at least see which tasks are avaialable to you and the documentation connected with them.
回答2:
The latest releases on Github do not include documentation (issue #24).
Older releases on Tigris do include documentation in the form of a CHM file: After installing MSBuild.Community.Tasks.msi from the project download page, the documentation is in the installation folder. The typical path is "C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.chm".
回答3:
The documentation is sublime, but missing completely. However, the code is really easy to read - at least for finding out available tasks and their inputs/outputs.
The way I do it:
Install a .NET decompiler like Jetbrains dotPeek (or some other .NET Reflector free clone).
PM> Install-Package MSBuildTasks
(from VS) OR> nuget install MSBuildTasks
(from cmd line)Open
slnDir\.build\MSBuild.Community.Tasks.dll
in the above mentioned dotPeek, navigate to namespaceMSBuild.Community.Tasks
and double-click the task you're interested in.Profit!
回答4:
Came across this as I was looking for the same info, so may as well add an example of a complete MSBuild target which creates an FTP folder and then copies the contents to the new location. NB the example uploads to a secure site, so you may need to change the port number to suit your situation.
<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>
回答5:
You can use the XSD to check available options as well.
Cheers.
来源:https://stackoverflow.com/questions/3762839/msbuild-community-tasks-documentation