Could not load WinSCP .NET assembly

Advertisement

axeconrad
Joined:
Posts:
1

Could not load WinSCP .NET assembly

Hello,
I'm trying to automate file transfer with powershell. I downloaded .NET assembly and write the code in powershell. I encountered a problem when I tried to load WinSCP .NET assembly.This the code to load WinSCP .NET assembly.
Add-Type -Path "C:\Users\TEST\Documents\WinSCP-5.15.2-Automation\WinSCPnet.dll"
And this is the error that I received
Add-Type: Unable to load the file or assembly 'file://C:\Users\TEST\Documents\WinSCP-5.15.2-Automation\WinSCPnet.dll' or one of its dependencies. This assembly has been co
built by a runtime newer than the runtime currently loaded and cannot be loaded.
Level C:\Users\TEST\Desktop\SynchroFile.ps1: 3 Character: 9
+ Add-Type -Path "C:\Users\TEST\Documents\WinSCP-5.15.2-Automation\WinSCPnet.dll"
+ CategoryInfo : NotSpecified: (:) [Add-Type], BadImageFormatException
+ FullyQualifiedErrorId: System.BadImageFormatException,Microsoft.PowerShell.commands.AddTypeCommand

Error: Cannot find the type [WinSCP.Protocol]: check that the assembly in which it is located is loaded.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum