I have an NAnt script that I use to build my .NET project, and I'm looking to see if there is a way to upload the resulted assemblies to some remote folder using an FTP task.
I couldn't find any good example online, and I'm wondering if anyone knows how to do it, if it's doable at all.
FYI: I'm running it on a windows machine, if it makes any difference.
You could use WinSCP as console application in a NAnt <exec>
task. Using WinSCP will give You access to extra goodies like synchronization.
That's what we are doing and it works like a charm.
Working WinSCP example here:
<exec
verbose="true"
program="WinSCP.exe"
basedir="${WinSCP.Folder.Install}">
<arg value="/command" />
<arg value="/log=D:\Logs\WinSCP\winscp.log" />
<arg value="/script=backup.winscp" />
<arg line="/parameter ${YOUR_FILE}" />
</exec>
where backup.winscp in above exec is a file with the following content
option batch abort
option confirm off
open ftp://user:[email protected]
put "%1%"
exit
Having the same need myself, I developed a basic FTP upload NAnt task. You can find it here: https://sourceforge.net/projects/w3c-nant/
Example usage (copy pasted from the site's API docs):
<ftpUpload host="ftp.myserver.com" username="root" password="r00t" todir="/">
<fileset basedir="dist">
<include name="**/*" />
<exclude name="**/*.config" />
</fileset>
</ftpUpload>
I already use it in my local build scripts to upload my site to its live server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With