Could not load file or assembly 'WinSCPnet' or one of its...

Advertisement

peterpatter
Joined:
Posts:
1

Could not load file or assembly 'WinSCPnet' or one of its...

Hi all,

I have an existing ASP.NET project and trying to incorporate WinSCP's SFTP functionality into this project.

I have followed the instructions on the .NET assembly / COM library section and performed the following actions:
- Renamed WinSCP.dll to WinSCPnet.dll
- Added the WinSCPnet.dll as a reference
- Added WinSCP.exe and the "original" WinSCP.dll into my project and set them to be copied to the output folder as per instructions

When I test the project that the WinSCP stuff is in, everything works fine.
But when I build the whole ASP.NET project and try to access the website, I get this error:
Could not load file or assembly 'WinSCPnet' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
This seems to be happening because the name of the WinSCP.dll has been changed to WinSCPnet.dll to get round the namespace conflict (as described in the instructions).
When I delete the WinSCPnet.dll from the bin directory the website works fine.

Has anyone else come across this?
Any ideas who to fix it?

Thanks
Peter

Reply with quote

Advertisement

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

Re: Could not load file or assembly 'WinSCPnet' or one of its...

The .NET assembly will have name WinSCPnet.dll officially since the next major release.

The only workaround for you until that, is not to rename the assembly. You can rename winscp.exe instead, or avoid including it into the project (and use Session.ExecutablePath to point to the new name or different location).

Reply with quote

manju
Guest

Could not load file or assembly 'WinSCPnet in SSIS

Hi ,

i am using SFTP in SSIS package to transfer the report from local to SFTP server.

But during transformation i am facing the below issue.
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.4.0.7781, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf' or one of its dependencies. The system cannot find the file specified.
File name: 'WinSCPnet, Version=1.4.0.7781, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf'
at ST_3a41ca636c1a4c4d842cfef4217f5cbd.csproj.ScriptMain.Main()
can you provide your suggestions to resolve this issue.

Reply with quote

Advertisement

You can post new topics in this forum