System.BadImageFormatException: Could not load file or assembly과 비슷한 오류가 있습니다. 그러나 오류를 발생시키는 조건은 다릅니다.System.BadImageFormatException : 파일 또는 어셈블리 또는 해당 종속성 중 하나를로드 할 수 없습니다.
Test Name: Test_DisableTestUserAccount
Test FullName:
Test Source:
Test Outcome: Failed
Test Duration: 0:00:00Result Message:
Unable to get type #typename#. Error: System.IO.FileLoadException: Could not load file or assembly 'ComponentName.IntTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a433f9a8cee952' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'ComponentName.IntTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=433f9a8cee952' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.VisualStudio.TestPlatform.MSTestFramework.TypeCache.LoadType(String typeName, String assemblyName)
조건 :
- 이 솔루션은
- InternalsVisibleTo 단위 프로젝트에 콘솔 응용 프로그램에서 사용할 수있는 C# 콘솔 응용 프로그램과 유닛 테스트 프로젝트
- 모든 프로젝트 런지 이름 을 체결 있습니다있다
- sln 플랫폼에는 x64와 x86 두 가지 구성이 있습니다 (나머지는 제거됩니다)
콘솔 앱의 내부 요소에 액세스 할 유닛 테스트 케이스를 실행하면 테스트 케이스가 실패하고 예외가 발생합니다.
을 - 호스트도
, 당신은 빌드를 확인해야합니다 프로젝트에서 x64를 명시 적으로 타겟팅하면 결코 유용하지 않습니다. 항상 AnyCPU를 선택하고 관리되지 않는 코드에 종속 된 경우에는 EXE 프로젝트에 x86 만 선택하십시오. –
시스템이 x64로 컴파일되었으므로 출시 목표입니다. 어쨌든 고맙습니다. – Amitabha
http://en.wikipedia.org/wiki/Cargo_cult_programming –