IT Share you

HRESULT : 0x80131040 : 찾은 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다.

shareyou 2020. 12. 8. 20:24
반응형

HRESULT : 0x80131040 : 찾은 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다.


찾은 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다.

ncover를 통해 nunit을 실행할 때 이것을 얻습니다. 어떤 생각?


이는 어셈블리 간의 불일치입니다. 어셈블리에서 참조 된 DLL에 예상 한 메서드 서명이 없습니다.

솔루션을 청소하고 모든 것을 다시 빌드 한 다음 다시 시도하십시오.

또한 이것이 GAC에있는 항목에 대한 참조 인 경우주의하십시오. 어딘가에서 잘못된 버전을 가리키는 것일 수 있습니다. 각 참조의 속성을 통해 올바른 버전이 선택되었는지 또는 특정 버전이 false로 설정되었는지 확인합니다.


나는 최근 에이 문제가 있었고 문제의 dll에서 'depends.exe'를 실행했습니다. 일부 종속성은 x64로 컴파일되는 동안 dll이 x86으로 컴파일되었음을 보여주었습니다.

여전히 문제가있는 경우에는 depends.exe를 사용하는 것이 좋습니다.


wcf 나머지 서비스 프로젝트의 경우 요청 된 dll이있는 web.config에 런타임 섹션을 추가해야했습니다.

  <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>

이는 일반적으로 테스트 환경의 DLL 중 하나의 버전이 개발 환경과 일치하지 않을 때 발생합니다.

솔루션을 정리하고 빌드하고 모든 DLL을 오류가 발생하는 환경으로 가져가 수정해야합니다.


모든 런타임 부분을 제거하여 문제를 해결했습니다.

<runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>

공유 폴더를 통해 다른 컴퓨터에서 프로젝트 파일에 액세스 할 때 비슷한 문제가 발생했습니다. 제 경우에는 clean + reabuild가 도움이되지 않았습니다. 출력 디렉토리에서 bin 및 objects 폴더를 삭제해야했습니다.


제 경우에는 디버깅하는 동안이 메시지를 받았습니다.

"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)"

원인

내 프로젝트에는 RestSharp를 사용하는 2 개의 내부 구성 요소가 있지만 두 구성 요소 모두 다른 버전의 RestSharp를 가지고 있습니다 (하나는 version 105.2.3.0, 다른 하나는 version 포함 106.2.1.0).

해결책

구성 요소 중 하나를 최신으로 업그레이드하거나 다른 구성 요소를 다운 그레이드하십시오. 내 경우에는 나를에서 다운 그레이드를 위해 더 안전 106.2.1.0105.2.3.0NuGet 패키지 관리자에서 구성 요소 및 업데이트보다. 따라서 두 구성 요소의 버전이 동일합니다.

재건하면 문제가 해결되었습니다.


내 특정 상황에서는 CreateObjectVBScript 에서 수행 한 결과로 이것을 얻었습니다 . 제 경우의 원인은 내가 컴파일 한 것보다 오래된 GAC에있는 어셈블리 버전이었습니다. (이전 문제를 해결하기 위해 GAC에 어셈블리를 설치했습니다).

따라서 COM 표시 클래스로 작업하는 경우 새 어셈블리를 RegASM에 등록하기 전에 GAC에서 이전 버전의 어셈블리를 제거해야합니다.


제 경우에는 WebGrease 때문에 발생했습니다. NuGet을 사용하여 최신 버전으로 업데이트했지만 종속성과 충돌했습니다. web.config에 아래 코드를 수동으로 추가했으며 매력으로 작동했습니다.

<dependentAssembly>
    <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>

Please note my solution will only work when the error is related to WebGrease. The error code will remain the same. Also, you need to change the version in oldVersion and newVersion accordingly.


Just deleted bin folder and project recreates all and now it is working.


I ran into this issue in a web api project.

Api project was using a nuget package of a library with version 3. And one of the referenced assemblies say X was using older version of the same nuget package with version 2.

Whenever referenced assembly is built or any other project referencing X is rebuilt, api project's assemblies gets updated with lower version. And got this assembly reference error.

Rebuild works but in my case I wanted a long term solution.

I made the assemblies reference same version of nuget package.


I had the issue where it wouldn't find the PayPal assembly and it was because I had named my solution PayPal. I'm sure this won't be the answer for anyone but thought I'd share it anyway: C# ASP.NET MVC PayPal not finding assembly


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.


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


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.


Just Check your webconfig file and remove this code :-

<dependentAssembly>
    <assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.13.0" newVersion="5.5.13.0" />
  </dependentAssembly>

I got this error when working in the Designer. I had been developing in VS 2012, but "upgraded" to 2017 over the past couple days. Solution was to close and reopen VS.

It may be related to a bug which I've seen reported elsewhere, where the Reference Manager does not work? In that situation, the following error message is encountered when trying to add a reference in the Solution Explorer:

"Error HRESULT E_FAIL has been returned from a call to a COM component."

My workaround was to close the solution, reopen in VS2012, add the reference, close 2012 and reopen 2017. Ridiculous that 2017 should have been released with such an obvious bug.


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

참고URL : https://stackoverflow.com/questions/93879/hresult-0x80131040-the-located-assemblys-manifest-definition-does-not-match-t

반응형