WinSCP nuget package not exployed when using PackageReference
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"
This was built with https://devblogs.microsoft.com/nuget/nuget-contentfiles-demystified/ as reference.
Thanks
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"?> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>WinSCP</id> <version>5.11.3</version> <title>WinSCP .NET assembly</title> <authors>Martin Prikryl</authors> <owners>Martin Prikryl</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <licenseUrl>https://www.mozilla.org/MPL/2.0/</licenseUrl> <projectUrl>https://winscp.net/eng/docs/library</projectUrl> <iconUrl>https://winscp.net/pad/winscp.png</iconUrl> <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> <contentFiles> <!-- Include Assets as Content --> <files include="WinSCP.exe" buildAction="None" copyToOutput="true" /> </contentFiles> </metadata> </package>
This was built with https://devblogs.microsoft.com/nuget/nuget-contentfiles-demystified/ as reference.
Thanks