簡體   English   中英

如何使nunit-console在程序集的\\ bin \\ Debug \\中而不是\\ bin \\ x86 \\ Debug中顯示?

[英]How do I make nunit-console look in \bin\Debug\ rather than \bin\x86\Debug for assemblies?

我正在嘗試設置構建機器,並希望從批處理腳本運行nunit(在多個相對較大的動態解決方案上)。 我運行了以下命令行

"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:

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)

對我來說,它看起來在錯誤的文件夾中:

C:\MyProjectPath\bin\x86\Debug\MyAssembly.dll

應該

C:\MyProjectPath\bin\Debug\MyAssembly.dll

是否可以在NUnit中指定此方法(或者必須在解決方案中指定)?

您可以將測試程序集路徑作為參數而不是解決方案文件傳遞:

"C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console-x86.exe" "C:\MyProjectPath\bin\Debug\MyAssembly.dll"

不知道是否可以做到這一點,但我認為大多數構建服務器都可以為您做到這一點。 TeamCity可以做到這一點 ,我相信其他人也可以做到 TeamCity既強大又免費(不超過特定項目限制)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM