我试图使用下面的代码在WinSCPnet.dll
中加载PowerShell文件,并且我得到了以下错误。
Set-Location "D:\WinSCP-5.17.10-Automation"
Add-Type -Path "WinSCPnet.dll"
无法加载文件或程序集“file:///D:\WinSCP-5.17.10-Automatio n\WinSCPnet.dll”或其依赖项之一。此程序集是由比当前加载的运行时更新的运行时生成的,无法加载。
行:2 char:9
在PowerShell 2.0中添加此程序集还有其他方法吗?如果不支持它,是否有WinSCPnet.dll
可用,它支持PowerShell 2.0?
发布于 2021-02-02 12:55:25
我认为问题不在于PowerShell 2本身。它是关于由.NET加载的PowerShell框架版本。当前版本的WinSCP .NET程序集以.NET 4.0为目标。你可能已经安装了那个版本。您只需要配置PowerShell来使用它。
有一篇WinSCP文章介绍了以下内容:
https://winscp.net/eng/docs/message_net_runtime_newer_than_currently_loaded
如建议的那样,试着:
set COMPLUS_version=v4.0.30319
powershell ...
https://stackoverflow.com/questions/66009929
复制相似问题