首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >N单元System.BadImageFormatException

N单元System.BadImageFormatException
EN

Stack Overflow用户
提问于 2017-11-09 17:31:54
回答 1查看 547关注 0票数 1

我在从命令行运行测试时遇到了一些问题。我有一个单独的测试项目,通常使用Rider,测试运行得无懈可击。但是,我希望在CI环境中运行它们,因此需要能够从命令行运行它们。

我正在尝试运行Projectname>"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe“Test\Test.csproj NUnit Console Runner 3.4.0版权所有(C) 2016查理普尔

代码语言:javascript
复制
Runtime Environment
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.42000

Test Files
    Test\Test.csproj

Errors and Failures

1) Error : Test.MVCmodel.CoilClassTest.CoilCreateEmptyIdTest
System.BadImageFormatException : Could not load file or assembly 'UserInterface, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
   at Test.MVCmodel.CoilClassTest.CoilCreateEmptyIdTest()

运行"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe“Test\bin\Debug\Test.dll”时也会发生同样的情况

测试项目位于MainProject中: Projectname\Projectname.csproj和Projectname\Test\Test.csproj

是的,我在Stackoverflow上发现了相当多类似的帖子,但我没有找到适用的解决方案。

EN

回答 1

Stack Overflow用户

发布于 2019-11-01 02:18:30

这为我解决了这个问题。在build settings下,将平台目标更改为x86

当然,这是假设UserInterface存在并在CLI环境之外良好地运行(如在visual studio中)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47198264

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档