在 MSBuild 项目中运行 Nunit 控制台会构建一个命令以执行测试,该命令包括大约 90 个路径,每个路径都是已编译测试项目 (.test.dll) 的完整路径,并且至少包含 100 个字符,但没有超过 150 个。
脚本运行时出现以下错误:
NUnit version 2.5.10.11092
Copyright (C) 2002-2009 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.5485 ( Net 2.0 )
ProcessModel: Default DomainUsage: Multiple
Execution Runtime: Default
Unhandled Exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Builds\123\XXXX\XXX.Build.Sonar\srcDroplocation\Build\x86\Release\xxxxx.xxxx.CustomTypes.Test.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, String msgPath, Boolea
n 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:\Builds\123\XXXX\XXX.Build.Sonar\src\Droplocation\Build\x86\Release\xxxxx.xxxx.CustomTypes.Test.dll”。该文件存在,我注意到在异常中 src 和 Droplocation 之间的路径中缺少反斜杠。
这个问题发生在我的构建服务器中,在我的本地机器上工作,不同之处在于我的本地机器上的文件夹不是那么深:'C:\T\XXX\Droplocation\Build\x86\Release\xxxxx.xxxx.CustomTypes .Test.dll'
使用 NUnit 的路径有什么限制吗?
我还尝试创建一个 .nunit 文件以将所有引用放在上面,但这会导致另一个问题