0

Running Nunit console inside a MSBuild project a command is built in order to execute the tests, that command includes about 90 paths, each one is the full path of a compiled test project (.test.dll) and contains at least 100 characters but no more than 150.

When the script run I got the following error:

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)

the original path of this file is 'C:\Builds\123\XXXX\XXX.Build.Sonar\src\Droplocation\Build\x86\Release\xxxxx.xxxx.CustomTypes.Test.dll'. The file exists, and I notice that in the exception there is a missing backslash in the path between src and Droplocation.

This issue happens in my build server, in my local machine works, the difference is that in my local machine the folder is not so deep : 'C:\T\XXX\Droplocation\Build\x86\Release\xxxxx.xxxx.CustomTypes.Test.dll'

Is there any restriction regarding the paths for the use of NUnit?

I also try to create a .nunit file in order to put all the references on it but it lead to another issue

GregC
  • 7,737
  • 2
  • 53
  • 67
XtianGIS
  • 967
  • 16
  • 39
  • UPDATE: I change the configuration to Debug, and something similar happened but with a different path, now the missing character in the exception is not a backslash, is a letter. It cannot find the file. Yes, I check the original path send it to the command, it is correct. – XtianGIS Feb 02 '16 at 19:13
  • How many characters down the path is the missing one? I'm curious whether each time the same location is being dropped. Are there any string replace commands going on in the build script? – Pedro Feb 02 '16 at 19:31
  • For the case of debug is in 87 characters, when is set for Release is in 40 characters. But if I count the position of the deleted character starting at the beginning of the parameters for the NUnit console both of them appear at 8005th position – XtianGIS Feb 02 '16 at 19:51

2 Answers2

0

The missing slash in the middle of your path is caused by your build script, not NUnit. My guess is that the build script is appending two strings together, neither of which have the necessary slash. If the same build script is working on your box, it may be a global variable on the server has no begin/end slash where the variable on your machine does.

Edit: Based on your comment above, you may be running into a Windows limitation. According to this support page, the command prompt is limited to 8191 characters. This limitation is after any environment variables are expanded. You may need to reduce the number of arguments or have the build server compile to a shorter path.

Pedro
  • 12,032
  • 4
  • 32
  • 45
  • Sorry, but the missing slash only appear in the message of the exception. The error in the Msbuild script was my first guess, but I check, and double check, but the path provided from MSBuild is correct, as a matter of fact the Msbuild script does not append two strings. – XtianGIS Feb 02 '16 at 18:18
  • The $(OutDir) is set just one time with a full path, so it is not made appending strings. furthermore, I print the command and check one by one the paths, all of them are ok, the one that trigger the exception is not the first one. – XtianGIS Feb 02 '16 at 18:42
0

Indeed it is bug in NUnit version 2.5.10.11092.

  1. Create a drive unit pointing to C:\Builds\123\XXXX\XXX.Build.Sonar\src\Droplocation

subst t: C:\Builds\123\XXXX\XXX.Build.Sonar\src\Droplocation

  1. change the $(OutDir) from C:\Builds\123\XXXX\XXX.Build.Sonar\src\Droplocation to t:
XtianGIS
  • 967
  • 16
  • 39