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?
2 Answers
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.

- 6,508
- 1
- 27
- 26
-
3Slick feature, never knew it existed until now. Too bad Filezilla doesn't offer anything like this. – Ryan Rodemoyer Dec 03 '13 at 12:47
-
too bad it only supports putty shh files – ihavenokia Nov 30 '18 at 16:17
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.
- from visual studio, publish in a folder, say
I:/www/WebProject
- use this command that updates changes only, and delete files that were deleted/absent from publish folder thanks to
--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 filec:/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)
- send your public key to the server, in your home folder:
scp ~/.ssh/id_rsa.pub servername:~/
- from your server (
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.

- 6,404
- 5
- 41
- 61
-
I don`t quite understand what is going on here, can you please elaborate more on each step. Though it is clear to me your answer is correct and interesting. what commands to run in the windows powershell, what commands is to run in the windows WSL, what commands to run in the remote Linux server – Raiden Core Jun 08 '22 at 16:05
-
@RaidenCore It's not exactly an answer for beginners, but it's not mysterious too. Only when I used a command starting with bash, it's from powershell, the rest is from local bash (wsl), and when it's not local (from server), I mentionned it. – Soleil Jun 08 '22 at 20:47
-