在 Teamcity 中使用捆绑版本的 dotCover 导致 "Target executable doesn't exist" 错误?

Using bundled version of dotCover in Teamcity resulting in "Target executable doesn't exist" error?

我们正在尝试设置 Teamcity,但在添加代码覆盖时 运行 遇到了一个问题,导致 "Target executable doesn't exist" 错误消息。

构建配置当前是否包含两个步骤;第一步是 运行ner 类型 Visual Studio (sln),第二步是 运行ner 类型 MSTest。在我们将 .NET Coverage 添加到 MSTest 步骤之前,这些 运行 很好。我们对 .NET Coverage 的配置是:

我们还尝试将 dotCover Home 路径和额外权限添加到构建服务器上的 Teamcity 文件夹,但错误仍然存​​在。我们添加了 "teamcity.agent.dotCover.log" 配置参数,它给了我们这个输出:

08:19:31.414 |I|                               | JetBrains dotCover Console Runner 3.0.2. Build 20150303.1317.
08:19:31.453 |I|                               | LogLevel: INFO
08:19:32.178 |I|                               | 'cover' command
08:19:32.180 |I|                               | /LogFile=D:\TeamCity\buildAgent\temp\buildTmp\dotCoverLogs\dotCover-cover-57200806543828190721.log (CommandLine)
08:19:32.180 |I|                               | /Executable=D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest (Xml)
08:19:32.180 |I|                               | /Arguments=/testcontainer:D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a\UnitTest.Notifications\bin\Release\UnitTest.Notifications.dll /testcontainer:D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a\UnitTest.Search\bin\Release\UnitTest.Search.dll /testcontainer:D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a\UnitTest.MiddleTier\bin\Release\UnitTest.MiddleTier.dll /testcontainer:D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a\UnitTest.Utils\bin\Release\UnitTest.Utils.dll /testcontainer:D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a\UnitTest.MiddleTier\bin\Release\UnitTest.Utils.dll /resultsfile:D:\TeamCity\buildAgent\temp\buildTmp\tmpE859.tmp.teamcity.trx (Xml)
08:19:32.180 |I|                               | /WorkingDir=D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a (Xml)
08:19:32.180 |I|                               | /TempDir=D:\TeamCity\buildAgent\temp\buildTmp (Xml)
08:19:32.180 |I|                               | /Output=D:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover13940396202529873921.data (Xml)
08:19:32.180 |I|                               | /Filters=+:UnitTest.Search.dll;-:JetBrains.BuildServer.*;-:JetBrains.TeamCity.* (Xml)
08:19:32.180 |I|                               | Current directory: D:\TeamCity\buildAgent\work\f09bf2f330c2ab9a
08:19:32.180 |I|                               | Validating command...
08:19:32.182 |I|                               | Executing command...
08:19:32.247 |W|                               | Target executable doesn't exist

--- EXCEPTION #1/2 [CommandExecutionException]
Message = “Target executable doesn't exist”
ExceptionPath = Root.InnerException
ClassName = JetBrains.dotCover.Core.ConsoleRunner.CommandExecutionException
HResult = COR_E_APPLICATION=80131600
Source = JetBrains.dotCover.Core
StackTraceString = “
  at JetBrains.dotCover.Core.ConsoleRunner.Commands.Cover.CoverCommand.Execute(CommandExecutionContext context)
     at JetBrains.dotCover.Core.ConsoleRunner.ConsoleRunnerBackend.Execute(ICommandLine commandLine, Func`1 componentContainerGetter)
”

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “Target executable doesn't exist”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “”

08:19:32.459 |I|                               | Target executable doesn't exist.
08:19:32.459 |I|                               | Console Runner execution finished
08:19:32.459 |I| Main                          | Console Runner exit code: -2

如果您能提供任何帮助我们解决此问题的建议,我们将不胜感激。谢谢

在一些帮助下,我已经能够解决这个问题,结果证明这是我添加的一个错误的系统参数。

为了解决单元测试不起作用的问题,我添加了这个系统参数:

Name:  system.MSTest.12.0
Value: D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest

这导致单元测试正常工作,但是当我配置代码覆盖率时,出现 "Target executable doesn't exist" 错误。为了解决这个问题,我必须将系统参数更新为:

Name:  system.MSTest.12.0
Value: D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe

我假设当单元测试工作时,我遇到的问题是 dotCover 而不是 MSTest,错误中没有任何其他指示。


附带说明一下,我必须添加系统参数的原因是因为 Teamcity 不会自动检测 MSTest 的安装。我认为这是因为它安装在不同的驱动器上,但我无法确认这一点。我已经向 JetBrains 提出了这个问题,希望他们能解决它。