When getting WinSCP .NET assembly using Nuget within a VS project that defines the dependencies with PackageReference, the EXE file is not copied next to build.
powershell scripts is not recommended for copy action as this is never triggered with this new standard.
Recommendation is to define files to copy within the nuspec file and let nuget do the deployment job.
Here is a example that might work (not tested):
Note that "WinSCP.exe" file should be stored in a folder named "contentFiles"
<?xml version="1.0" encoding="utf-8"?>
<title>WinSCP .NET assembly</title>
<description>The WinSCP .NET assembly is a .NET wrapper around WinSCP’s scripting interface that allows your code to connect to a remote machine and manipulate remote files over SFTP, SCP, WebDAV and FTP sessions.
The library is primarily intended for advanced automation tasks that require conditional processing, loops or other control structures for which the basic scripting interface is too limited. The library is not a general purpose file transfer library. It particularly lacks support for interactive processing and as such it is not well suited for use in GUI applications.
For documentation and examples of use, see project website.
The NuGet package includes the assembly itself and a required WinSCP executable. When installed, it adds the assembly as reference to your project and sets up WinSCP executable to be copied to project output directory, so that it can be found on run-time.</description>
<summary>The WinSCP .NET assembly is a .NET wrapper around WinSCP’s scripting interface.</summary>
<copyright>Copyright © 2012-2017 Martin Prikryl</copyright>
<tags>winscp sftp ftp ftps webdav scp transfer</tags>
<!-- Include Assets as Content -->
<files include="WinSCP.exe" buildAction="None" copyToOutput="true" />
This was built with https://devblogs.microsoft.com/nuget/nuget-contentfiles-demystified/