Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# MSTest无法调用在x86下构建的库_C#_Unit Testing_Mstest - Fatal编程技术网

C# MSTest无法调用在x86下构建的库

C# MSTest无法调用在x86下构建的库,c#,unit-testing,mstest,C#,Unit Testing,Mstest,我试图添加一个MSTest项目来调用一个只能编译为x86的库。当组合一个测试项目时,我发现即使我将“测试->测试设置->默认处理器架构”设置为x86,我仍然必须将所有引用的项目和MSTest项目平台目标设置为“任何CPU” 否则,在尝试调试或运行测试时会出现异常- "System.BadImageFormatException: Could not load file or assembly '[*ClassLibraryName*], Version=1.0.0.0, Culture=neut

我试图添加一个MSTest项目来调用一个只能编译为x86的库。当组合一个测试项目时,我发现即使我将
“测试->测试设置->默认处理器架构”
设置为x86,我仍然必须将所有引用的项目和MSTest项目平台目标设置为
“任何CPU”

否则,在尝试调试或运行测试时会出现异常-

"System.BadImageFormatException: Could not load file or assembly '[*ClassLibraryName*], Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format."
如何设置它,以便能够测试和调试x86库的测试

其他信息 MSTest项目-.NETCore2.1
类库-.Net Framework 4.6.1

这是在.Net Framework上使用.Net Core“MSTesting项目”的问题。更改为“.Net Framwork”单元测试项目并没有相同的问题