System.BadImageFormatException与Oracle.DataAccess并与AMD64不匹配

时间:2019-06-19 10:27:22

标签: c# .net oracle unit-testing visual-studio-2017

我正在Visual Studio 2017 Professional上构建项目UnitTest vbproj 。 当我使用“任何CPU”进行构建时,会有一个警告:

warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

然后运行我的测试用例,所有这些都失败了。测试用例的错误之一是:

Message: Test method [name of method] threw exception: 
System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.

所以我改用x64平台->有45个错误和8个警告,因为它不适合我的项目。 然后,我更改为平台x86->平台x84收到相同的错误。

我现在该怎么办?我试图通过许多方法来解决此问题,但是不能。

0 个答案:

没有答案