WinSCP nuget package not exployed when using PackageReference

Advertisement

cazzoo
cazzoo avatar
Joined:
Posts:
5
Location:
France

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"
<?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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: WinSCP nuget package not exployed when using PackageReference

Actually a support for PackageReference has been implemented already.
https://winscp.net/tracker/1581
I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

cazzoo
cazzoo avatar

Thanks for the feedback about this package. I'll test it ASAP and give you return about this. Any plan about new pkg delivery on nuget.org repository?
Last edited by cazzoo on 2018-01-11 09:57; edited 2 times in total

Reply with quote

martin
Site Admin
martin avatar

cazzoo wrote:

Thanks for the feedback about this package. I'll test it ASAP and give you return about this. Any plan about new pkg delivery on nuget.org repository?
It will be released to nuget.org, once 5.12.x goes stable.

Reply with quote

cazzoo
cazzoo avatar

Just tested right now and it's working fine! Noticed a slightly change over the Session.ScanFingerprint signature but I think it's coming features that will be documented later on. By the way, this new package solves the issue. If no plan is done for release for now, would you plan to add it to the repository as prerelease ?

Reply with quote

Advertisement

cazzoo
cazzoo avatar
Joined:
Posts:
5
Location:
France

martin wrote:

OK, 5.12 beta is now published.
https://www.nuget.org/packages/WinSCP/5.12.0-beta
Note that it has the old signature of the ScanFingerprint method. So you will have to revert your change.

https://winscp.net/tracker/1598
Thumb up !

Thanks for the update. I found a workaround disabling fingerprint lookup temporary. I'll wait for official release (and doc release to get my code updated).

By the way, thanks for the quick action regarding beta release :)

Reply with quote

Advertisement

You can post new topics in this forum