TFS 构建 2015 "Warning: Unable to create DiaSession for..." NUnit

TFS Build 2015 "Warning: Unable to create DiaSession for..." NUnit

当尝试 运行 单元测试作为 TFS Build 2015 (vNext) 中的构建步骤时,我收到以下警告:

Warning: Unable to create DiaSession for <assembly>
No source location data will be available for this assembly.

然后测试程序集是 运行,但是里面的单元测试失败了,因为它们找不到引用,我假设是因为警告的 'No source location data will be available' 部分。

我用于单元测试的 NUnit NuGet 包是:"NUnitTestAdapter.WithFramework" v2.0.0。该项目是用 C# 制作的。

我看过 this 问题,但我不太明白他们在说什么,而且他们似乎没有使用 TFS Build 2015 (vNext) 构建定义。

有什么想法吗?

您提到的问题是关于旧的 TFS 构建 XAML 而不是 vNext 构建您正在使用的那个。

但是,您也可以在 vNext Visual Stduio Build 或 MSbuild 任务中使用相同的 MSBuild 参数。

You need to use add the /p:NoWarn=warningNumber in MSBuild Arguments in the build definition. Or use the /p:WarningLevel=0 argument to suppress all warnings.

根据您的错误信息,问题似乎与 TFS 构建端无关。由于内部单元测试因找不到引用而失败,请尝试直接 运行 在本地(远程)构建代理上进行测试。这将帮助您缩小问题范围。此外,还Enable Verbose Debug Mode for TFS Build vNext通过添加system.debug=true查看是否有更详细的日志信息以进行故障排除。