Could not load file or assembly or one of its dependencies
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 assembly 'Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have no idea what is causing this or how I could debug it to find the cause.
I've done a search in my solution catalogs .csproj files, and every where I have Unity I have:
Reference Include="Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
Can't find any reference anywhere which goes against 1.2.0.0 in any of my projects.
Any ideas how I should go about solving this?
I would also appreciate tips on how to debug problems like this in general.
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.
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.
Open IIS Manager
Select Application Pools
then select the pool you are using
go to advanced settings (at right side)
Change the flag of Enable 32-bit application false to true.
For me, none of the other solutions worked (including the clean/rebuild strategy). I found another workaround solution which is to close and re-open Visual Studio .
I guess this forces Visual Studio to re-load the solution and all the projects, rechecking the dependencies in the process.
链接地址: http://www.djcxy.com/p/56936.html上一篇: 无法加载文件或程序集...该参数不正确
下一篇: 无法加载文件或程序集或其依赖项之一