Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is AutoUnify and why is it causing working tests to fail in TFS 2015

We're running our own NuGet server to package our own projects. In this case, we're reusing some test builders. The unit tests pass when run locally, but through TFS 2015 some fail with the below error.

I've completed a Find in Files in these projects / packages to locate the 2.6.4 dependency without success.

What is AutoUnify, where is AutoUnify configured? Is disabling AutoUnify the correct approach to this problem?

 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.

Update: A good explanation of AutoUnify is via MSDN, but this does not explain how to disable

Update: These particular tests were failing only via TFS Build due to the version of the NUnit Test adapter being use by the build definition. Leaving this question open as it'd be interesting to hear where AutoUnify is configured.

like image 948
ManxJason Avatar asked Oct 21 '15 09:10

ManxJason


2 Answers

Not sure there's a way to directly "disable" autounify... However in VS2017 you can make the build fail when there're dependency conflicts. When the build fails it'll tell you the exact dlls that are conflicting and which project they're in.

Either modify your .csproj with this custom property

<MSBuildWarningsAsErrors>MSB3277</MSBuildWarningsAsErrors>

Or create a Directory.Build.props file at the solution level to impact all the projects in that solution. Directory.Build.props should have something similar to this 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>
like image 146
tariq Avatar answered Sep 28 '22 08:09

tariq


It appears that the only way to disable the automatic binding redirects is to manually edit the project file of the unit test project (either .csproj or .vbproj). The link in Rob's answer walks you through how to do it, but essentially it is just changing this line:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

to this:

<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
like image 22
JamesQMurphy Avatar answered Sep 28 '22 06:09

JamesQMurphy