Could not load file or assembly or one of its dependencies

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

    Thanks Riddhi M. Following worked for me.

    Remove Temporary Files C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files Close VSTS and Open Again Remove and Add the same DLLs (Note: you add the same matching versions)

    0 讨论(0)
  • 2020-11-22 03:41
    • Goto :Solution -> Package
    • Click on Advanced Tab (Find below the page)
    • Add your dll to additional assemblies(this way we can add external dlls in sharepoint).
    0 讨论(0)
  • 2020-11-22 03:42

    Juntos answer is correct but you should also consider:

    For the unity v2.1.505.2 different AssemblyVersion and AssemblyFileVersion attributes are specified:

    enter image description here

    AssemblyFileVersion is used by the NuGet but CLR does not care about it! CLR is going to use only AssemblyVersion!

    So your redirects should be applied to a version that specified in AssemblyVersion attribute. So 2.1.505.0 should be used

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

    See also: What are differences between AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion?

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

    You say you have a lot of projects in your solution ... well, start with one near the top of the build order. Get that one to build and once you figure it out you can apply the same fix to the rest of them.

    Honestly, you probably just need to refresh your reference. It sounds like you either updated your version and didn't update the references, or it's a relative path issue if you keep your solution in source control. Just verify your assumptions, and re-add the reference.

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

    Try to clean Debug and Release folders in your solution. Then remove and add unity again.

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

    Following worked for me.

    • Remove Temporary Files C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
    • Close VSTS and Open Again
    • Remove and Add the same DLLs (Note: you add the same matching versions)
    0 讨论(0)
提交回复
热议问题