在PowerShell中加载WinSCP-无法加载文件或程序集-该程序集由比当前加载的运行时新的运行时构建 [英] Loading WinSCP in PowerShell - Could not load file or assembly - This assembly is built by a runtime newer than the currently loaded runtime

查看:353
本文介绍了在PowerShell中加载WinSCP-无法加载文件或程序集-该程序集由比当前加载的运行时新的运行时构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误消息:

添加类型:无法加载文件或程序集"file:///D:\ WinSCP-5.15.2-Automation \ WinSCPnet.dll"或其依赖项之一.该程序集由比当前加载的运行时新的运行时构建,无法加载.我将WinSCP.dll与WinSCP.exe放在同一文件夹**

Add-Type : Could not load file or assembly 'file:///D:\WinSCP-5.15.2-Automation\WinSCPnet.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. I placed WinSCP.dll same folder together with WinSCP.exe**

我运行PowerShell v2.0.

I run PowerShell v2.0.

错误消息中存在问题

引起问题的脚本行如下所示:

The script line that causes the problem looks as following:

#Load WinSCP .NET assembly
Add-Type -Path "C:\users\Desktop\WinSCPnet.dll"

该帖子与此链接 PowerShell运行时异常- 无法加载文件或程序集" ,并且我尝试了链接中发布的每种方法,但无法解决.有什么我想念的吗?

This post almost similar with this link PowerShell runtime exception - "could not load file or assembly" and I tried every method posted in the link and unable to solve it. Is there anything I missed out?

推荐答案

您可能具有旧版本的.NET Framework.

You probably have an old version of .NET Framework.

WinSCP .NET程序集目标.NET Framework 4.0的最新版本.

Recent versions of WinSCP .NET assembly target .NET Framework 4.0.

WinSCP 5.13.9是在.NET 2中可用的最后一个版本.

WinSCP 5.13.9 was the last version that worked in .NET 2.

不过,您应该使用最新版本的WinSCP.毕竟是安全软件.如果无法安装.NET Framework 4,则可以使用 WinSCP脚本代替.NET程序集. WinSCP本身对.NET Framework(或其他任何东西)没有任何依赖性.并且可在Windows XP以后的所有版本的Windows上运行.

You should use the latest version of WinSCP though. It's a security software after all. If you cannot install .NET Framework 4, you can use WinSCP scripting instead of .NET assembly. WinSCP itself does not have any dependency on .NET Framework (or anything else). And runs on all versions of Windows since Windows XP.

这篇关于在PowerShell中加载WinSCP-无法加载文件或程序集-该程序集由比当前加载的运行时新的运行时构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆