Could not load file or assembly or one of its dependencies

前端 未结 30 1462
生来不讨喜
生来不讨喜 2020-11-22 03:18

I\'m having another of these \"Could not load file or assembly or one of its dependencies\" problems.

Additional information: Could not load file or

相关标签:
30条回答
  • 2020-11-22 03:46
    1. Check if you are referencing an assembly which in turn referencing an old version of unity. For example let's say you have an assembly called ServiceLocator.dll which needs an old version of Unity assembly, now when you reference the ServiceLocator you should provide it with the old version of Unity, and that makes the problem.

    2. May be the output folder where all projects build their assemblies, has an old version of unity.

    You can use FusLogVw to find out who is loading the old assemblies, just define a path for the log, and run your solution, then check (in FusLogvw) the first line where the Unity assembly is loaded, double click it and see the calling assembly, and here you go.

    0 讨论(0)
  • 2020-11-22 03:46

    In my case, none of the proposed answer worked.

    Here is what worked for me:

    1. Remove the reference
    2. Rename the DLL
    3. Import the reference again

    The second step was important apparently as it did not work without it.

    0 讨论(0)
  • 2020-11-22 03:47

    My solution for .NET 4.0, using Enterprise Library 5, was to add a reference to:

    Microsoft.Practices.Unity.Interception.dll

    0 讨论(0)
  • 2020-11-22 03:48

    In my case in the bin folder was a non reference dll called Unity.MVC3 , i tried to search any reference to this in visual studio without success, so my solution was so easy as delete that dll from the bin folder.

    0 讨论(0)
  • 2020-11-22 03:49

    Look out for conflicting references. Even after a clean and rebuild, conflicting references will still cause a problem. My problem was between AForge and Accord. I removed both of the references, and re-added the references re-choosing the particular reference (particular to my case, just Accord).

    0 讨论(0)
  • 2020-11-22 03:50

    At 99% the Could not load file or assembly or one of its dependencies problem is caused by dependencies! I suggest you follow this steps:

    1. Download Dependency Walker from http://www.dependencywalker.com/

    2. Launch Dependency Walker and open the dll (in my case NativeInterfaces.dll)

    3. You can see one or more dll with the error in red Error opening file...

    4. It means that this dll is missing in your system; in my case the dll name is MSVCR71.DLL

    5. You can download missings dll from google and copy in right path (in my case c:\windows\system32)

    6. At this point, you must register the new dll in the GAC (Global Assembly Cache): open a DOS terminal and write:

      cd \Windows\System32
      regsvr32 /i msvcr71.dll
      
    7. Restart your application!

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