首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使nunit-console在\bin\Debug\而不是\bin\x86\Debug中查找程序集?

如何使nunit-console在\bin\Debug\而不是\bin\x86\Debug中查找程序集?
EN

Stack Overflow用户
提问于 2012-10-23 21:52:49
回答 2查看 1.9K关注 0票数 4

我正在尝试设置一台构建机器,并希望从批处理脚本运行nunit (在几个相对较大和动态的解决方案上)。我运行了以下命令行

代码语言:javascript
复制
"C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console-x86.exe" "C:\MySolutionPath\MySolution.sln"
"C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console.exe" "C:\MySolutionPath\MySolution.sln"

两者都给出了System.IO.DirectoryNotFoundException:

代码语言:javascript
复制
NUnit-Console version 2.6.1.12217
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 2.0.50727.5456 ( Net 3.5 )

ProcessModel: Default    DomainUsage: Default
Execution Runtime: net-3.5
Unhandled Exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\MyProjectPath\bin\x86\Debug\MyAssembly.dll'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean
 useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, St
ring msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at NUnit.Core.AssemblyReader.CalcHeaderOffsets()
   at NUnit.Core.AssemblyReader..ctor(String assemblyPath)
   at NUnit.Util.RuntimeFrameworkSelector.SelectRuntimeFramework(TestPackage package)
   at NUnit.Util.DefaultTestRunnerFactory.GetTargetProcessModel(TestPackage package)
   at NUnit.Util.DefaultTestRunnerFactory.MakeTestRunner(TestPackage package)
   at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
   at NUnit.ConsoleRunner.Runner.Main(String[] args)

在我看来,它似乎在错误的文件夹中查找:

代码语言:javascript
复制
C:\MyProjectPath\bin\x86\Debug\MyAssembly.dll

应该是

代码语言:javascript
复制
C:\MyProjectPath\bin\Debug\MyAssembly.dll

有没有办法在NUnit中指定它(或者如果必须在解决方案中)?

EN

回答 2

Stack Overflow用户

发布于 2012-10-23 21:55:47

您可以将测试程序集路径作为参数而不是解决方案文件进行传递:

代码语言:javascript
复制
"C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console-x86.exe" "C:\MyProjectPath\bin\Debug\MyAssembly.dll"
票数 2
EN

Stack Overflow用户

发布于 2012-10-23 22:31:57

我不知道是否可以做到这一点,但我认为大多数构建服务器都可以为您做到这一点。TeamCity can do that,我相信其他人也可以。TeamCity很棒,而且是免费的(在一定的项目限制下)。

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

https://stackoverflow.com/questions/13032056

复制
相关文章

相似问题

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