Is there a way to publish a web site from Visual Studio 2008 using SCP or SFTP? I know it is possible to publish to my local filesystem and then perform the transfer with SCP, but I'd like something more seamless (e.g. part of Visual Studio). Does this feature exist? An addin perhaps?
The built in system for publishing pages is a little bit limited.
One thing that I find useful is with WinSCP, there is a featured called "Keep Remote Directory up to Date". What it will do is set a bunch of file system watchers for your local system and if you change something locally, it will auto upload it. Using that and publishing to a local directory makes things easy.
If you have Windows 10 and bash/linux subsystem installed and a Linux/BSD server you can:
Combine ssh and rsync
I prefer to use rsync
through a ssh
pipe, since it won't upload files that werer not modified, it's more efficient.
I:/www/WebProject
--delete
bash -c "rsync -avH --delete --progress /mnt/i/www/WebProject -e ssh server:/var/www/"
Where I:/www/WebProject
is the local folder where the project was published, and /var/www
the remote directory of the web application.
Preparation (to do once)
You need to work a bit to allow ssh to work without password but with keys.
let's say your bash username is also the same on the server; if not, just use username@server
name your server:
add xx.xx.xx.xx server
to the file c:/windows/system32/drivers/etc/hosts
)
add your server to hosts from bash with sudo echo "xx.xx.xx.xx server" >> /etc/hosts
from bash, generate your keys:
ssh --keygen
then [enter] (no passphrase)
scp ~/.ssh/id_rsa.pub servername:~/
ssh server
then password):cat id_rsa.pub >> .ssh/authorized_keys && rm id_rsa.pub
Now you can ssh
and scp
without password. IMO this is way better than filezilla or just scp.
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