Error VSP1033: The file '...' does not contain a recognized executable image.
특정 DLL의 Code Coverage를 위해 vsinstr.exe를 실행했는데,
d:\temp>vsinstr -coverage .\bin\Test.dll
Microsoft (R) VSInstr Post-Link Instrumentation 14.0.25420 x86
Copyright (C) Microsoft Corp. All rights reserved.
Error VSP1033: The file 'd:\temp\UnitTest\bin\Test.dll' does not contain a recognized executable image.
보는 바와 같이 실행 가능한 이미지가 아니라면서 instrumentation 코드 삽입에 실패를 합니다. 딱히 검색을 해봐도 이에 대한 글이 없습니다.
실행된 vsinstr.exe는 32비트 버전임을 where 명령어를 통해서 알 수 있었고,
d:\temp>where vsinstr.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\vsinstr.exe
혹시나 싶어 명시적으로 x64 버전의 vsinstr.exe를 실행해 봤더니 이렇게 잘 됩니다. ^^;
d:\temp>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64\vsinstr.exe" -coverage Test.dll
Microsoft (R) VSInstr Post-Link Instrumentation 14.0.25420 x64
Copyright (C) Microsoft Corp. All rights reserved.
File to Process:
d:\temp\Test.dll --> d:\temp\Test.dll
Original file backed up to d:\temp\Test.dll.orig
Warning VSP2001: d:\temp\Test.dll is a strongly named assembly. It will need to be re-signed before it can be executed.
Successfully instrumented file d:\temp\Test.dll.
이상하군요. 분명히 Test.dll은 AnyCPU 모드로 빌드했는데 저렇게 vsinstr.exe의 플랫폼 영향을 받다니!
더욱 이상한 것은, 동일한 DLL을 Visual Studio가 설치된 다른 컴퓨터에서 32비트 버전의 vsinstr.exe를 실행했더니... 잘 됩니다. ^^; 그렇다면 DLL 자체의 문제는 아닌 듯싶고, 뭔가 환경적인 요인이 있는 듯한데 일단 더 이상의 파악은 할 수 없었습니다.
참고로, vsinstr.exe의 32/64비트 실행 파일은 각각 다음의 폴더에 있습니다.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]