[Problem description]
當某個 Project A (ex: unit test project) 使用某個 Project B,此時 compile 沒有問題,但是執行 Project A 卻發生下列錯誤訊息:
System.BadImageFormatException : Could not load file or assembly 'Project B, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
[Root cause]
Project A 與 Project B 並不同為是 32-bit (或是 64-bit) 平台 (target platform)
[Solution]
編輯這兩個Projects 的 Platform target 同為 x86 (或是 64),如下:
當某個 Project A (ex: unit test project) 使用某個 Project B,此時 compile 沒有問題,但是執行 Project A 卻發生下列錯誤訊息:
System.BadImageFormatException : Could not load file or assembly 'Project B, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
[Root cause]
Project A 與 Project B 並不同為是 32-bit (或是 64-bit) 平台 (target platform)
[Solution]
編輯這兩個Projects 的 Platform target 同為 x86 (或是 64),如下:
沒有留言:
張貼留言