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.
[code]
Add-Type -Path "C:\Users\TEST\Documents\WinSCP-5.15.2-Automation\WinSCPnet.dll"
[/code]

And this is the error that I received
[code]
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.
[/code]

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,103
Location:
Prague, Czechia

Re: Could not load WinSCP .NET assembly

Make sure you have the latest version of .NET framework and PowerShell installed.

Reply with quote

Advertisement

You can post new topics in this forum