DLL looking for wrong version


I have developed a class library (dll) that uses WinSCPnet.dll in Visual Studio 2015. While troubleshooting why it was looking for the wrong dll, I added the Nuget for it, getting the most recent version. The version we are using is actually a few before that, so I uninstalled the latest (using Nuget) and installed the version I want. Now, when it runs, it is looking for the newest version.

System.IO.FileLoadException: Could not load file or assembly 'WinSCPnet, Version=, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have tried searching the registry, gacutil /u (which ran successfully and removed the dll but I still get this message), cleaned the project and rebuilt, deleted everything in bin and obj and rebuilt - what am I missing?


asked on Stack Overflow Oct 30, 2019 by randallisms • edited Oct 30, 2019 by randallisms

1 Answer


Try this :

Unload your project , right click, edit .csproj file .. find your reference , it's gone be something like this <Reference Include="WinSCPnet, Version= .../>", edit that create open close Reference tag <Reference></Reference> Inside put <HintPath>path to your dll file here</HintPath>

Hope this helps!?

answered on Stack Overflow Oct 30, 2019 by J.Memisevic

User contributions licensed under CC BY-SA 3.0