Search code examples
c#.net.net-assemblywinscpwinscp-net

The version of ...\WinSCP.exe does not match version of this assembly when using WinSCP .NET assemly


I'm using a library called WinSCPnet.dll. The code will only work if I set the AssemblyFileVersion to the same version as the WinSCP.exe where it is installed.

I got this exception:

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).

How can I run my code independent from the WinSCP version?

I searched for a similar question but nothing worked for me.


Solution

  • You should not rely on installed version of WinSCP.

    Your application should deploy its own copy of WinSCP.exe, which application's version of WinSCPnet.dll is compatible with. Ideally, use WinSCP NuGet package, which takes care of that.

    For other options, see WinSCP .NET assembly installation and deployment instructions.