Search code examples
visual-studio-2015winscpwinscp-net

WinSCP.exe does not match version of this assembly


I tried to update to the latest version of WinSCP.

We do have the .exe in our project. I made sure it was the correct version, and it has "Copy"

Getting Error:

Exception thrown: 'WinSCP.SessionLocalException' in WinSCPnet.dll The version of \corp\someShareDrive\Utils\WinSCPWrapper\WinSCPWrapperGet_v0100\WinSCP.exe (5.9.6.0) does not match version of this assembly D:\Source\Neal\Git\WinAppWinSCP\WinSCPWrapperGet\bin\Debug\WinSCPnet.DLL (5.19.6.0).

The above directory on our shared network drive exists, but I can't find why it's referenced when I run the program in Visual Studio (2015, as we need to stay compatible with an older version of BizTalk). How could the error be concerned about that odd directory, especially when I have the WinSCP.exe in my project (and it's also the correct version in my /debug directory after doing the build)?

My .csproj has the following, and I know 5.19.6 is the correct new version.

<Reference Include="WinSCPnet, Version=1.8.3.12002, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL">
  <HintPath>..\packages\WinSCP.5.19.6\lib\net40\WinSCPnet.dll</HintPath>
  <Private>True</Private>
</Reference>

I cannot find any reference to the network sharedrive in the .csproj file. I did a Nuget install or upgrade.

I've seen these related questions: The version of ...\WinSCP.exe does not match version of this assembly when using WinSCP .NET assemly and DLL looking for wrong version but I think my question is different - I'm trying to figure out why it's using the .exe on a ShareDrive.

After posting the above, I did a Nuget uninstall, the an install, same issue.


Solution

  • I scanned the entire source code directory for the sharedrive name and found it in the app.config file.

    The program set the "ExecutablePath" using a variable from the app.config file:

    if (!String.IsNullOrWhiteSpace(WinSCPExePath)) session.ExecutablePath = WinSCPExePath;
    

    So I just needed to change the config file.