3

我正在尝试使用内置的 Visual Studio Tests 运行器在 TeamCity(版本 9.1.6 build 37459)上执行单元测试。我使用它的原因是某些单元测试使用的是 Fakes 程序集,无法使用 MSTest 执行。

执行该步骤时,它会失败并System.ArgumentException: Illegal characters in path.出现以下日志异常

Custom logger detection logic disabled
VSTest will report tests to TeamCity after run
VSTest executable: "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
Command line params: [[C:\TeamCity\buildAgent\work\475c180054f4c61d\NS\TestProject\bin\Debug\TestProject.dll] [/Settings:NS/localtestrun.testsettings] [/Logger:trx] [/Platform:x86]]
Starting: "C:\Program Files (x86)\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit
in directory: C:\TeamCity\buildAgent\work\475c180054f4c61d
2016-02-16 15:07:01,920 [7092] ERROR JetBrains.BuildServer.NAntLoggers.NUnitLauncher2 - Illegal characters in path.
System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.IsPathRooted(String path)
   at JetBrains.TeamCity.Utils.FileUtil.MakeFullPath(String path, String workDir) in c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\FileUtil.cs:line 48
   at JetBrains.TeamCity.GenericProcessSupport.GenericProcessTargetGenerator.GenerateTargetContent(IGenericProcessArguments argz) in c:\BuildAgent\work\ad31cec0a1b0f083\src\GenericProcessSupport\src\GenericProcessTargetGenerator.cs:line 31
   at JetBrains.TeamCity.GenericProcessSupport.GenericProcessRunnerFactory.CreateRunner(ITestRunArguments args) in c:\BuildAgent\work\ad31cec0a1b0f083\src\GenericProcessSupport\src\GenericProcessRunnerFactory.cs:line 35
   at JetBrains.BuildServer.NAntLoggers.RunnerFactory.FindTestRunner(ITestRunArguments arguments) in c:\BuildAgent\work\ad31cec0a1b0f083\src\NUnitBootstrap\src\RunnerFactory.cs:line 46
   at JetBrains.BuildServer.NAntLoggers.RunnerFactory.CreateTestRunner(ITestRunArguments arguments) in c:\BuildAgent\work\ad31cec0a1b0f083\src\NUnitBootstrap\src\RunnerFactory.cs:line 31
   at JetBrains.BuildServer.NAntLoggers.NUnitLauncher2.Run2(String[] args) in c:\BuildAgent\work\ad31cec0a1b0f083\src\NUnitBootstrap\src\NUnitLauncher2.cs:line 100
   at JetBrains.BuildServer.NAntLoggers.NUnitLauncher2.Run(String[] args) in c:\BuildAgent\work\ad31cec0a1b0f083\src\NUnitBootstrap\src\NUnitLauncher2.cs:line 56

我在网上找到的所有文章/博客文章都没有工作,我既无法分辨包含非法字符的路径或这些字符是什么。

有人可以帮忙吗?谢谢。

4

1 回答 1

1

面临同样的问题。经过数小时的谷歌搜索后,问题是在参数值中添加了引号。删除它,它会工作。找到它,将成功的构建日志与失败的日志进行比较。成功运行时,此行中没有引号: VSTest 可执行文件: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe

于 2018-11-02T16:09:09.027 回答