我正在使用一个名为 WinSCPnet.dll
的库。仅当我将 AssemblyFileVersion
设置为与其安装位置的 WinSCP.exe
相同的版本时,该代码才有效。
我遇到了这个异常:
The version of C:\Program Files (x86l\WinSCP\WinSCP.exe (5.15.1.0) does not match version of this assembly C:\Users\burkarty\source\repos\UAReport3\UAReport3\bin\Debug\UAReport3.exe (0.0.0.0).
如何独立于 WinSCP 版本运行我的代码?
我搜索了类似的问题,但没有任何效果。
最佳答案
您不应依赖已安装的 WinSCP 版本。
您的应用程序应部署自己的 WinSCP.exe
副本,该应用程序的 WinSCPnet.dll
版本与其兼容。理想情况下,使用 WinSCP NuGet package ,它负责处理这个问题。
有关其他选项,请参阅 WinSCP .NET assembly installation and deployment instructions .
关于c# - 使用 WinSCP .NET 程序集时,...\WinSCP.exe 的版本与该程序集的版本不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56643006/