unit-testing - 什么是 AutoUnify 以及为什么它会导致 TFS 2015 中的工作测试失败

标签 unit-testing tfs nuget tfsbuild

我们正在运行我们自己的 NuGet 服务器来打包我们自己的项目。在这种情况下,我们重用了一些测试构建器。单元测试在本地运行时通过,但通过 TFS 2015,有些失败并出现以下错误。
我已经完成了在这些项目/包中的文件中查找以定位 2.6.4 依赖项,但没有成功。
什么是 AutoUnify,AutoUnify 在哪里配置?禁用 AutoUnify 是解决此问题的正确方法吗?

 Unified Dependency "nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77".
         Using this version instead of original version "2.6.3.13283" in "D:\Agents\Agent1\c81e9061\eServices\.NugetLocalCache\EnterpriseApplications.Framework.Testing.1.0.0.0\lib\net45\EnterpriseApplications.Framework.Testing.dll" because AutoUnify is 'true'.
         Using this version instead of original version "2.6.3.13283" in "D:\Agents\Agent1\c81e9061\eServices\.NugetLocalCache\EnterpriseApplications.Framework.Testing.Mvc.1.0.0.0\lib\net451\EnterpriseApplications.Framework.Testing.Mvc.dll" because AutoUnify is 'true'.
         Could not resolve this reference. Could not locate the assembly "nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
更新:AutoUnify 的一个很好的解释是通过 MSDN ,但这并没有解释如何禁用
更新:由于构建定义使用的 NUnit 测试适配器版本,这些特定测试仅通过 TFS 构建失败。让这个问题保持开放,因为听到 AutoUnify 的配置位置会很有趣。

最佳答案

不确定有没有办法直接“禁用”自动统一……但是在 VS2017 中,当存在依赖冲突时,您可以使构建失败。当构建失败时,它会告诉您发生冲突的确切 dll 以及它们在哪个项目中。

使用此自定义属性修改您的 .csproj

<MSBuildWarningsAsErrors>MSB3277</MSBuildWarningsAsErrors>

或者在解决方案级别创建 Directory.Build.props 文件以影响该解决方案中的所有项目。 Directory.Build.props 应该有类似于这个 xml 的东西:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
   <MSBuildWarningsAsErrors>MSB3277</MSBuildWarningsAsErrors>
  </PropertyGroup>
</Project>

关于unit-testing - 什么是 AutoUnify 以及为什么它会导致 TFS 2015 中的工作测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33256071/

相关文章:

iphone - 使用 Cruise Control 运行 Xcode iPhone 单元测试

tfs - 一个产品团队的VSO和多个项目

powershell - 如何在 TFS2013 构建中将构建参数和其他信息传递给 powershell 脚本?

c# - 无法将 nuget 包安装到 azure 函数中

nuget - 如何在 LINQPad 中将 Visual Studio Team Services 用作 NuGet 源

java - 您能否在不显式列出它们的情况下从命令行运行包中的所有 JUnit 测试?

unit-testing - 您如何决定在您的测试套件中测试什么?

asp.net-mvc-3 - 模拟 Request.QueryString 用于单元测试并针对 View 进行断言

tfs - 识别 Team Foundation Server 的版本

c# - 'ILoggerFactory' 不包含 'AddConsole' 的定义