This post was originally published here

Cutting a long story short I was exploring migrating a BizTalk 2013 solution to BizTalk 2016.  The solution uses SFTP and I wanted to migrate from the open source Blogical SFTP adapter to the out of the box SFTP adapter which has had some enhancements.  The documentation around this enhancement and in particular the setup is lacking.  It will not work out of the box from a BizTalk install unless you additionally setup WinSCP.  The problems are:

  1. The BizTalk documentation lists the wrong version on the dependencies, you need 5.7.7 not 5.7.5
  2. The WinSCP pages cover lots of other versions and it can be confusing because while their documentation is good and detailed, it talks about using WinSCP with the GAC which you will assume you need for BizTalk.  This is a red herring so dont read this bit unless you need to
  3. There is WinSCP and WinSCP .net library.  I got confused between the two and didnt initially realise I need both

To get this up and running the steps you need to follow are:

  1. Download WinSCP and the .net Library making sure you get the right versions
  2. Copy the .exe and .dll to the BizTalk installation folder
  3. DO NOT gac anything.  If you GAC the .net library it will not work because it expects WinSCP.exe to be in the same path so thats why they both go in the BizTalk installation folder

This is pretty simple enough in the end but I felt the easiest way to ensure you get the right version is to use NuGet to get version 5.7.7 and to make your life even simpler just use the powershell script below once you have setup your BizTalk environment and it will do it for you.  You just need to set the path for your BizTalk install folder and also where you want to download NuGet stuff to.

$downloadNoGetTo = “F:SoftwareWinSCP”
$bizTalkInstallFolder = “F:Program Files (x86)Microsoft BizTalk Server 2016”

#Download NuGet
Write-Host “Downloading Nuget”
$sourceNugetExe = “”
$targetNugetExe = “$downloadNoGetTonuget.exe”
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe

#Download the right version of WinSCP
Write-Host “Downloading WinSCP from NuGet”
Invoke-Expression “$targetNugetExe Install WinSCP -Version 5.7.7 -OutputDirectory $downloadNoGetTo”

#Copy WinSCP items to BizTalk Folder
Write-Host “Copying WinSCP Nuget to BizTalk Folder”
Copy-Item “$downloadNoGetToWinSCP.5.7.7contentWinSCP.exe” $bizTalkInstallFolder
Copy-Item “$downloadNoGetToWinSCP.5.7.7libWinSCPnet.dll” $bizTalkInstallFolder