HRESULT: 0x80131040: The located assembly's manifest definition does not match the assembly reference

后端 未结 19 2297
庸人自扰
庸人自扰 2020-12-02 19:27

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

getting this when running nunit through ncover. Any idea?

相关标签:
19条回答
  • 2020-12-02 20:19

    Just another case here. I had this error from Managed Debugging Assistant on the first time deserializing a XML file into objects under VS2010/.NET 4. A DLL containing classes for the objects is generated in a post-build event (usual Microsoft style stuff). Worked very well for several projects in same solution, problem appeared when doing that in one more of the projects. Error text:

    BindingFailure was detected Message: The assembly with display name MyProjectName.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileLoadException: Could not load file or assembly MyProjectName.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    Since some answers here suggested a platform mismatch, I noticed that 3 projects and the solution had "mixed platforms" configuration selected, and 3 projects were compiled for x86 instead of AnyCPU. I have no platform-specific code (though some vendor-provided DLLs rely on a few x86 libraries). I replaced all occurrences of x86 into AnyCPU with this:

    for a in $( egrep '(x86|AnyCPU)' */*.csproj *.sln -l  ) ; do echo $a ; sed -i 's/x86/AnyCPU/' $a ; done
    

    Then the project would build but all options to run or debug code would be greyed out. Restarting VS would not help.

    I reverted with git the references to the x86-library, just in case, but kept AnyCPU for all the code I compile.

    Following F5 or Start Debugging Button is Greyed Out for Winform application? I unloaded and reloaded the starting project (it was also the one where the initial problem appeared in the first place).

    After that, everything fell back into place: the program works without the initial error.

    See http://www.catb.org/jargon/html/R/rain-dance.html , http://www.catb.org/jargon/html/V/voodoo-programming.html or http://www.catb.org/jargon/html/I/incantation.html and links there.

    0 讨论(0)
  • 2020-12-02 20:20

    In my case I got this message while debugging:

    "Error while calling service <ServiceName> Could not load file or assembly 'RestSharp, 
    Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. 
    The located assembly's manifest definition does not match the assembly reference.
    (Exception from HRESULT: 0x80131040)"
    

    Cause

    In my project I have had 2 internal components using the RestSharp but both component have different version of RestSharp (one with version 105.2.3.0 and the other with version 106.2.1.0).

    Solution

    Either upgrade one of the components to newer or downgrade the other. In my case it was safer for me to downgrade from 106.2.1.0 to 105.2.3.0 and than update the component in NuGet package manager. So both components has the same version.

    Rebuild and it worked with out problems.

    0 讨论(0)
  • 2020-12-02 20:25

    This happened to me when I updated web.config without updating all referenced dlls.

    Using proper diff filter (beware of Meld's default directory compare filter ignoring binaries) the difference was identified, files were copied and everything worked fine.

    0 讨论(0)
  • 2020-12-02 20:27

    If you got this error trying to add a component to Visual Studio,- Microsoft.VisualStudio.TemplateWizardInterface - (after trying to install weird development tools)

    consider this solution(courtesy of larocha (thanks, whoever you are)):

    1. Open C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.config in a text editor
    2. Find this string: "Microsoft.VisualStudio.TemplateWizardInterface"
    3. Comment out the element so it looks like this:

    <dependentAssembly>
    <!-- assemblyIdentity name="Microsoft.VisualStudio.TemplateWizardInterface" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" / -->
    <bindingRedirect oldVersion="0.0.0.0-8.9.9.9" newVersion="9.0.0.0" />
    </dependentAssembly>

    source: http://webclientguidance.codeplex.com/workitem/15444

    0 讨论(0)
  • 2020-12-02 20:27

    I just delete settings.lic file from project and start working!

    0 讨论(0)
  • 2020-12-02 20:28

    In my case for a wcf rest services project I had to add a runtime section to the web.config where there the requested dll was:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
            <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
          </dependentAssembly>
    .
    .
    .
      <runtime>
    
    0 讨论(0)
提交回复
热议问题