Problems with WinSCP .NET assembly in SSIS Script Task

Advertisement

Comedian
Joined:
Posts:
1
Location:
Croatia

Problems with WinSCP .NET assembly in SSIS Script Task

Hi,

I'm having trouble getting the WinSCP .NET assembly to function in the SSIS Script Task (Visual Studio Professional 2017) to work. Basically I want to use this assembly, in order to be able to get new or modified files from an SFTP server (SFTP script doesn't suffice to accomplish this task).

I have installed the corresponding NuGet package from the link below:
https://www.nuget.org/packages/WinSCP/

I have done the following steps in my SSIS package:

1. Add a Script Task to the Control Flow (I can only install the NuGet package in the Script Task and not in the package).
2. After clicking on Edit Script go to Tools – NuGet Package Manager – Package Manager Console to access the Package Manager.
3. Type in the following in the Package Manager:
Install-Package WinSCP -Version 5.19.5
4. Confirm that WINSCPnet has been added to the References.
5. Left Click on the Project (still inside the Script Task) and click Build

Even though I didn't add any additional code I still get the following error:
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\WinSCP.5.19.5\build\WinSCP.targets.
I have looked around for a solution and most suggestions suggest are akin to the following link:
https://stackoverflow.com/questions/52582330/this-project-references-nuget-packages-that-are-missing-on-this-computer-the

The solution is to delete this code snippet from the csproj file and in the SSIS case from the package XML file:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
 </Target>
When I do that, the error message above disappears. Nonetheless all references to the WinSCP assembly are broken and when I try to add using WinSCP to the C# namespace it's not recognized.

Why does this issue occur and has anybody found a solution?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum