DLL looking for wrong version - c#

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=1.6.5.9925, 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?
Thanks!

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

Related

Error: "Could not load file or assembly Newtonsoft.Json" appears during runtime after merging two branches. Both branches run fine on their own

I've been stuck with this bug after merging two branches together. The solution builds with no issues, but as soon as I call any function that uses Newtonsoft.Json I get the following exception at runtime:
Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
I've looked around and have tried:
Re-installing the nuget package on the affected project
Re-installing the nuget package on all projects running Newtonsoft.Json
Updating all projects in the solution to be the same version of Newtonsoft.Json, then cleaning and
rebuilding the solution
Digging through .csproj files to find Newtonsoft references and manually updating them to the same
version.
When I manually copy and paste the 6.0.0.0 dll into the debug folder I get no issues, however as soon as I clean/ rebuild Visual Studio puts the wrong dll version into the folder again. Even after updating the Nuget package in the affected project to the latest version of Newtonsoft.Json the error still states that it is looking for version 6.0.0.0 rather than 12.0.0.0.
Am I missing something? Any help would be appreciated.
EDIT:
Using .net Framework 4.7
Just to clarify: when I say "wrong dll" I meant it puts the dll that I want it to use in the bin folder (12.0.0.0), but the program see's it as the wrong version, expecting version 6.0.0.0.
Was finally able to get it working. Ditched 12.0.0.0 completely, does not seem that there is a way to get Microsoft.AspNet.WebApi.Client working with any version beyond 6.0.0.0

Could not load file or assembly 'GMap.NET.Core, Version=1.7.5.0

I am trying to load a map on my project. I'm using WPF on my project but since I can't use the "Overlays" I'm using to put a marker, and it's working on WindowsForm, I am now using it and calling it to the WPF form, until I encountered this error.
Could not load file or assembly 'GMap.NET.Core, Version=1.7.5.0,
Culture=neutral, PublicKeyToken=b85b9027b614afef' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I look in my references, and I only have a reference to GMap.NET.Core version 1.7.0.0.
Can anybody please help me should I solve this?
You need to just download the project of Gmap.Net from here next extract the project files open Release-NETv(any_version)
this contain assembly of Gmap.Net.Core ,so just add reference of this assembly in your project.
Here is what happens when assemblies not matches this is not same problem but will help you understand.
Example Of Incorrect Reference
Error
Solution
To solve this kindly open your app config file and see the version number of gmap package there then check the version number of gmap inside your references if they not match delete dll from references and change the version number to 1.7.5.0 in your appconfig then rebuild project visual studio automatically restore the missing assemblies so they will be same on both sides
For your better understanding please look this screen shot when I have an assembly in references uses version which is less the version is being use in project appconfig.
When you install a package from package manager it goes inside package folder of your application to add this,delete the reference from references if contain old version then add latest version from package folder.
Error Solve
By changing the version in appconfig the error was gone.
3 yers later lol
replace this value on app.config
Example assemblyIdentity name="GMap.NET.Core" publicKeyToken="b85b9027b614afef" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.7.5.0" newVersion="1.7.5.0"

Could not load file or assembly 'System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKey

After doing push from git server I got this error when I build and open my project:
Could not load file or assembly 'System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=******' or one of its dependencies. The system cannot find the file specified.
The project is working pretty well with the same code in a different computer.
Problem
The error is a file not found, like the one I helped out with the other day:
Could not load file or assembly .. The system cannot find the file specified.
Troubleshooting
Open ProcessMonitor and run it when VS won't let you build your solution and throws the error. Stop the trace when it fails and investigate ProcMon's (Filemon) log to see where the IDE is looking for the DLL it cant find.
Solution
Put the DLL where its expected to be found (this will hopefully sort out the VS library referencing failure).
Also try:
disable Resharper
restart VS
clean & rebuild
I found nuget or some other update can bump the System.Web.MVC version to 4.0.0 unintentionally. So just check the dll that you have in your bin folder (or wherever the reference points) is of the same version specified in your web.config.

Could not load file or assembly occurs after few days

I took over a project recently and it's using the NopCommerence package. When I load up the package in Visual Studio, it works fine, I have no troubles in VS, when I push live, everything is fine too, all works, but as soon as a few days sometimes even hours have passed, I get this error message:
Could not load file or assembly 'NPOI, Version=2.0.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
To solve this, I have to clean, rebuild and build the project and release a new set of files, my question is why does it randomly just fall over after so much time? I tried resetting the server, deleting temporary files but no luck.
Been doing this for weeks now and I can't find a solution.
This seems to be an issue where your .NET assembler is looking for an assembly of a specific version and instead of finding that, it is finding the assembly of that same thing, but of a different version.
It means that it wont work until both the files, i.e the actual file at the location and the reference in your configuration are same.
Check your config and then check on the actual file. If its of older or newer version, then replace it with the version that is actually required.
Here are a few links for your reference.
Assembly version mismatch
Resolving assembly conflicts
Hope this helps.

nopCommerce assembly dont find dll reference

Im having some serous issues with a .dll not being found in Nop.Core.dll (i think)
the dll message the PluginManager.cs writes in the output in VS12 is as follows:
Could not load file or assembly 'Telerik.Web.Mvc, Version=2012.2.607.340, Culture=neutral, PublicKeyToken=29ac1a93ec063d92' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Ive added the right version of Telerik.Web.Mvc to the Nop.Core lib and built a new .dll but the issue still remains.
Ive also checked for cached .dlls in th GAC but nothing.
The issue occured after a restart of VS12 so there´s smt weird going on here. Ive tried disabling/enabeling auto update nuget on build (as i thought that it might be fetching some new dlls that might create a conflict) but nothing.
I do see that the Solution is running .net 4.5 but the Telerik.Web.Mvc.dll target framework is :
TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")].
Can this cause some dll´s to not find Telerik.Web.Mvc.dll?
As im new to nopCommerce im kinda lost at this point. What am i doing wrong here? =)
/seb
Edit:
Make sure you have non-corrupted Telerik.Web.Mvc.dll in your bin folder (download one that comes with nopcommerce and overwrite it to be sure)
This issue may be caused by a plugin that has wrong reference. If you have any custom/old plugins try removing them or readd their reference and recompile.
Current version in 3.10 is 2013.2.611.340 while you have reference to 2012.2.607.340

Categories