The located assembly's manifest definition does not match the assembly reference

前端 未结 30 2059
北恋
北恋 2020-11-22 01:41

I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error:

System.IO.FileLoadException: Co

相关标签:
30条回答
  • 2020-11-22 01:53

    In my case, this error occurred while running an ASP.NET application. The solution was to:

    1. Delete the obj and bin folders in the project folder

    Clean didn't work, rebuild didn't work, all references were fine, but it wasn't writing one of the libraries. After deleting those directories, everything worked perfectly.

    0 讨论(0)
  • 2020-11-22 01:56

    I just ran across this issue and the problem was I had an old copy of the .dll in my application debug directory. You might want to also check there (instead of the GAC) to see if you see it.

    0 讨论(0)
  • 2020-11-22 01:56

    My issue was copying source code to a new machine without pulling over any of the referenced assemblies.

    Nothing that I did fixed the error, so in haste, I deleted the BIN directory altogether. Rebuilt my source code, and it worked from then on out.

    0 讨论(0)
  • 2020-11-22 01:58

    I just ran into this problem myself, and I found that the issue was something different than what the others have run into.

    I had two DLLs that my main project was referencing: CompanyClasses.dll and CompanyControls.dll. I was getting a run-time error saying:

    Could not load file or assembly 'CompanyClasses, Version=1.4.1.0, Culture=neutral, PublicKeyToken=045746ba8544160c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference

    Trouble was, I didn't have any CompanyClasses.dll files on my system with a version number of 1.4.1. None in the GAC, none in the app folders...none anywhere. I searched my entire hard drive. All the CompanyClasses.dll files I had were 1.4.2.

    The real problem, I found, was that CompanyControls.dll referenced version 1.4.1 of CompanyClasses.dll. I just recompiled CompanyControls.dll (after having it reference CompanyClasses.dll 1.4.2) and this error went away for me.

    0 讨论(0)
  • 2020-11-22 01:58

    I got this error while building on Team Foundation Server's build-service. It turned out I had multiple projects in my solution using different versions of the same library added with NuGet. I removed all old versions with NuGet and added the new one as reference for all.

    Team Foundation Server puts all DLL files in one directory, and there can only be one DLL file of a certain name at a time of course.

    0 讨论(0)
  • 2020-11-22 01:58

    To me the code coverage configuration in the "Local.testtesttings" file "caused" the problem. I forgot to update the files that were referenced there.

    0 讨论(0)
提交回复
热议问题