tag:help.appveyor.com,2012-11-13:/discussions/problems/15126-systemvaluetuple-version-makes-build-fail-it-runs-fine-locallyAppVeyor: Discussion 2018-11-17T16:36:10Ztag:help.appveyor.com,2012-11-13:Comment/456980672018-07-17T01:19:40Z2018-07-17T01:19:40Z'System.ValueTuple' version makes build fail. It runs fine locally<div><p>You probably build and run tests in Visual Studio locally. If you try to do the same in command line as AppVeyor test does, you would probably hit the same issue.</p>
<p>I cloned your repository and reproduced the error. I connected with RDP and see that file version is different between <code>Bin\EndToEndWithFake\Infra\System.ValueTuple.dll</code> and <code>packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</code> which is the reason for test error.</p>
<p>Then I changed build verbosity to <code>normal</code> and see that this file it being copied 2 times:</p>
<ul>
<li><a href="https://ci.appveyor.com/project/IlyaFinkelshteyn/samples-specifications/build/1.0.8#L1752">from packages location</a></li>
<li>the later <a href="https://ci.appveyor.com/project/IlyaFinkelshteyn/samples-specifications/build/1.0.8#L2169">overwritten</a> from <code>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.ValueTuple.dll</code> as part of <code>_CopyFilesMarkedCopyLocal</code> target.</li>
</ul>
<p>I found couple of discussions <a href="https://stackoverflow.com/questions/1682096/how-do-i-override-copylocal-private-setting-for-references-in-net-from-msbuil">here</a> and <a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/1cc8c12a-a520-4c28-b53b-733878ba0ad3/msbuild-amp-copylocal-being-set-to-true-when-in-vs-it-is-false?forum=msbuild">here</a> but solutions proposed here did not work for me and seems a little bit intrusive.</p>
<p>Simple but maybe not very smart-looking solution worked for me is to re-build single test project after the build, which overwrites that dll to the correct one. E.g. adding this:<br></p>
<pre>
<code>after_build:
- cmd: msbuild "Samples.Specifications.Tests.Acceptance.Specs/Samples.Specifications.Tests.Acceptance.Specs.csproj" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"</code>
</pre>
fixed the problem in my fork. <a href="https://ci.appveyor.com/project/IlyaFinkelshteyn/samples-specifications/build/1.0.14">Here</a> is successful build (I set settings in UI).</div>Ilya Finkelshteyn