Could not load file or assembly or one of its dependencies

前端 未结 30 1406
生来不讨喜
生来不讨喜 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:50

    I had this today, and in my case the issue was very odd:

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Host.SystemWeb" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.0" newVersion="3.1.0.0" />
      </dependentAssembly>0.
    

    Note the stray characters at the end of the XML - somehow those had been moved from the version number to the end of this block of XML!

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Host.SystemWeb" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
      </dependentAssembly>
    

    Changed to the above and voila! Everything worked again.

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

    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.

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

    Check the Web.config/App.config file in your project. See if the version numbers are correct.

    <bindingRedirect oldVersion="X.X.X.X-X.X.X.X" newVersion="X.X.X.X" />
    

    This worked for me.

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

    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.

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

    This issue happened to me where one of my dependent libraries was compiling a DLL with "Any CPU" when the parent library was expecting a compilation of "x64".

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

    Microsoft Enterprise Library (referenced by .NetTiers) was our problem, which was in turn referencing an older version of Unity. In order to solve the problem we used the following binding redirection in the web.config:

    <configuration>
        <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                    <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                    <bindingRedirect oldVersion="1.0.0.0-2.0.414.0" newVersion="2.1.505.0" />
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="Microsoft.Practices.Unity.Configuration" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                    <bindingRedirect oldVersion="1.0.0.0-2.0.414.0" newVersion="2.1.505.0" />
                </dependentAssembly>
            </assemblyBinding>
        </runtime>
    </configuration>
    

    Alternatively, you may want to just update the Enterprise Library to the latest version.

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