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



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

Hi all,

I have an existing ASP.NET project and trying to incorporate WinSCPs 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?


Reply with quote

Site Admin
martin avatar
Prague, Czechia

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

The .NET assembly will have name WinSCPnet.dll officialy 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


You can post new topics in this forum