Topic "SSIS script task using WinSCP error"

Author Message
NickP

Guest


Hi,

I have developed an SSIS package in BIDS 2008 R2, which works great from the machine I developed it on. However, when I moved the package to the server, I get the following error:
Download Archives,,,6/5/2014 9:15:59 AM,6/5/2014 9:15:59 AM,1,0x,System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf' or one of its dependencies. The system cannot find the file specified.
File name: 'WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf'
at ST_ce65898ba1554af38f9ffa906d6d024a.csproj.ScriptMain.Main()

I have added the WinSCPnet.dll to the following folders:
- C:\Program Files\Microsoft SQL Server\100\DTS\Binn
- C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies

I have also registered the assembly, using the following command:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCP.dll /codebase /tlb and it created the type library WinSCPnet.tlb in the \\prddsspm001\c$\Program Files\Microsoft SQL Server\100\DTS\Binn folder

I have also added the path to the environment variables!

No luck with any of the above corrections. Any help in this regard would be highly appreciated.

Thanks in advance!
Nick.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Did you try to debug loading using Fuslogvw.exe?
https://msdn.microsoft.com/en-us/library/e74a18c4.aspx
anub
[View user's profile]

Joined: 2014-06-20
Posts: 1
Location: United States
Hi, I am encountering the same issue, in a similar environment. I followed your suggestion prikryl, but it isn't illuminating for me what is wrong. This is the full exception:

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf' or one of its dependencies. The system cannot find the file specified.
File name: 'WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf'
at ST_c8729c8a88144f1cb830af581ce9e217.csproj.ScriptMain.Main()

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\Program Files (x86)\Microsoft SQL Server\100\DTS\binn\DtsDebugHost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = anub
LOG: DisplayName = WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
(Fully-specified)
LOG: Appbase = file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\Program Files (x86)\Microsoft SQL Server\100\DTS\binn\DtsDebugHost.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: WinSCPnet, Version=1.1.4.3970, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet.DLL.
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet/WinSCPnet.DLL.
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet.EXE.
LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft SQL Server/100/DTS/binn/WinSCPnet/WinSCPnet.EXE.

--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

I get this is an esoteric issue, with SSIS being what it is, but any guidance would be greatly appreciated. I'm stuck. WinSCP is in Microsoft SQL Server/100/DTS/Binn/ and Program Files (x86)/WinSCP/ and my script task is Using WinSCP; and has a reference to the dll contained in Program Files (x86)/WinSCP/.
ptreston

Guest


Did you manage to resolve this issue ? I am having the same problem. Works fine on my local development environment but when i deploy the SSIS Package to my Production Server, I am receiving the same error.
ptreston

Guest


I solved my issue by registering the WinSCPnet.dll in the GAC. It involved copying over the gacutil.exe and 2 other related files to my Windows 2008R2 Server to register the file. More info can be found here: http://stackoverflow.com/questions/7787607/drag-and-drop-a-dll-to-the-gac-assembly-in-windows-server-2008-net-4-0
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
I'm not an expert in SSIS. But in general, references to .NET libraries are not stored with paths in the compiled binary, no matter that you have an explicit path selected in reference in Visual Studio. I assume that when you develop locally, Visual Studio copies the WinSCPnet.dll to the project output directory for you (reference property Copy Local is enabled by default). That's why it's found when testing.

As you have found yourself meanwhile, you need to install the assembly to GAC:
http://winscp.net/eng/docs/library_install#gac

I have now explicitly documented the error you were getting:
http://winscp.net/eng/docs/message_net_system_cannot_find_file_specified
Guest




Thanks prikryl. Very Happy
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License