2013-07-18 3 views
3

그래서 이와 비슷한 질문이 많이 있었지만 지난 날 많은 답변을 통해 도움을 얻었습니다.DLL로드시 FileLoadException

많은 외부 DLL을 참조하는 WPF 응용 프로그램을 개발 중입니다. 문제를 일으키는 것으로 입증 된 DefinitionInterpreter라는 DLL이 특히 하나 있습니다. 내가 참조하는 모든 프로젝트에서, 그것은 완고하고 일하지 않기로 결정합니다. 내 단위 테스트 제품군에서 작동하도록 할 수 있었지만, WPF 응용 프로그램에서 작동하도록 시도 할 수는 없습니다.

저는 GAC를 시도해 보았습니다. 제 프로젝트를 청소하고, 추가하고, 제거하고, 다시 시작하고, 버전을 확인하고, 종속성을 확인하고, 아무 것도 작동하지 않습니다. '버전 = 3.6.0.0, 중립 문화 =, PublicKeyToken = null이 DefinitionInterpreter'또는 해당 종속성 중 하나를

파일 또는 어셈블리를로드 할 수 없습니다 :

나는 같은 예외를 점점 계속. 찾은 어셈블리의 매니페스트 정의가 어셈블리 참조와 일치하지 않습니다. (HRESULT 예외 : 0x80131040)

ildasm.exe에서 DLL을 열려고 시도했지만 비정상적으로 표시되지 않았습니다. System.Xml, System.Core 및 mscorlib 만 종속성입니다. 내가 매니페스트를 검사 할 때

, 그것은 버전이 3.6.0.0

정말 날 내 프로젝트 중 하나에서 작동한다는 것입니다 얻는 일이 있는지 확인합니다,하지만 난 또 다른에서 동작하지 않습니다 , 비록 그들은 같은 DLL (동일한 경로와 모든것)을 참조하고있다.

제안 사항? .NET 4.0 (4.0이라는 프로젝트 요구 사항)을 사용 중이며 x86 및 x64를 모두 사용해 보았습니다.

편집 :

퓨전 로그 세부 사항을 본 후, 나는 출력으로이 얻을 :

*** Assembly Binder Log Entry (7/18/2013 @ 7:07:42 PM) *** 

The operation failed. 
Bind result: hr = 0x80131040. No description available. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll 
Running under executable E:\Src\Hermes\Tool\bin\Debug\HermesClient.vshost.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: DisplayName = DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null 
(Fully-specified) 
LOG: Appbase = file:///E:/Src/Hermes/Tool/bin/Debug/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = HermesClient.vshost.exe 
Calling assembly : SomeAssembly, Version=13.5.13.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: E:\Src\Hermes\Tool\bin\Debug\HermesClient.vshost.exe.Config 
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. 
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 
LOG: Attempting download of new URL file:///E:/Src/Hermes/Tool/bin/Debug/DefinitionInterpreter.DLL. 
LOG: Assembly download was successful. Attempting setup of file: E:\Src\Hermes\Tool\bin\Debug\DefinitionInterpreter.dll 
LOG: Entering run-from-source setup phase. 
LOG: Assembly Name is: DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=75a99a2a5bcd4c96 
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN 
ERR: The assembly reference did not match the assembly definition found. 
ERR: Run-from-source setup phase failed with hr = 0x80131040. 
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 

은 다음 내 CSProj에 참조가 될 때 :

<Reference Include="DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=75a99a2a5bcd4c96, processorArchitecture=MSIL"> 
     <SpecificVersion>False</SpecificVersion> 
     <HintPath>..\..\..\..\DefinitionInterpreter.dll</HintPath> 
     <Private>True</Private> 
    </Reference> 

내가 수행 할 때 명령 sn -T DefinitionInterpreter.dll 나는 75a99a2a5bcd4c96을 얻습니다. 솔직히 말해서 런타임시 공개 키 토큰이 null이고 불일치가있는 이유를 어떻게 생각합니까?

+4

"Fusion Log Viewer"를 사용하여 두 경우 모두에서로드 된 위치를 확인할 수 있습니다. 이유에 대한 아이디어를 줄 수 있습니다. 주어진 양의 정보로 대답 할 가능성은 낮습니다. –

+0

@AlexeiLevenkov Fusion 로그 뷰어를 사용하여 게임을하고 나면 알기 쉬운 이유로 공개 키가 일치하지 않습니다. –

+0

로그가 예외 메시지와 일치하지 않으므로 로그를 업데이트하십시오. 이 프로젝트를 C : 드라이브에 복사하여 적어도 하나의 가능한 실패 모드를 제거하십시오. –

답변

2

로그에서 "SomeAssembly"는 해당 서명되지 않은 버전의 DLL에 연결되어 있지만 모든 로컬 버전은 서명되어있는 것처럼 보입니다.

"SomeAssembly"를 직접 만들면 "DefinitionInterpreter"에 대한 참조가 서명 된 버전을 가리키는 지 확인하십시오. 그렇지 않으면 "SomeAssembly"가 서명되지 않은 버전을 참조하고 소유자에게 다른 버전을 제공하도록 요청하는 ILDasm을 다시 확인하십시오.

+0

이것은 결국 딱 들어 맞았습니다. Alexei에게 감사드립니다. 약간의 구식 인 "SomeAssembly"의 잘못된 복사본을 사용하고있는 것으로 나타났습니다. –

관련 문제