Fix double-writes in test projects (#39778)
authorViktor Hofer <viktor.hofer@microsoft.com>
Wed, 22 Jul 2020 18:15:17 +0000 (20:15 +0200)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2020 18:15:17 +0000 (20:15 +0200)
* Fix double-writes in test projects

eng/testing/xunit/xunit.console.targets
eng/testing/xunit/xunit.props

index 837b432a99eb7d09dd8e4e5fd3e22a50594ffcd6..6364d461124c57a190ab28122534836668301e1e 100644 (file)
@@ -37,6 +37,7 @@
                       Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
     <PackageReference Include="xunit.runner.console"
                       Version="$(XUnitVersion)"
+                      GeneratePathProperty="true"
                       Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
   </ItemGroup>
 
@@ -62,7 +63,9 @@
     <ItemGroup>
       <!-- Copy test runner to output directory -->
       <None Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\*"
-            Exclude="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.*exe.config;$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.x86.exe"
+            Exclude="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.*exe.config;
+                     $([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.x86.exe;
+                     $([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.abstractions.dll"
             Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(XunitConsole472Path)' != ''"
             CopyToOutputDirectory="PreserveNewest"
             Visible="false" />
             CopyToOutputDirectory="PreserveNewest"
             Visible="false" />
     </ItemGroup>
+
+    <!-- Workaround for https://github.com/xunit/xunit/issues/1651 -->
+    <ItemGroup Condition="'$(ArchiveTests)' != 'true'">
+      <None Remove="$(Pkgxunit_runner_visualstudio)\build\net452\xunit.runner.utility.net452.dll" />
+      <None Remove="$(Pkgxunit_runner_visualstudio)\build\net452\xunit.runner.reporters.net452.dll" />
+      <None Remove="$(Pkgxunit_runner_visualstudio)\build\netcoreapp2.1\xunit.runner.utility.netcoreapp10.dll" />
+      <None Remove="$(Pkgxunit_runner_visualstudio)\build\netcoreapp2.1\xunit.runner.reporters.netcoreapp10.dll" />
+    </ItemGroup>
   </Target>
 </Project>
index 8b21cecac618e3396c797befe843c5ecec66f17c..69355a452a48eecc507f94b44d39ee557f65e5bc 100644 (file)
@@ -16,7 +16,7 @@
   <ItemGroup Condition="'$(ArchiveTests)' != 'true'">
     <!-- Microsoft.Net.Test.Sdk brings a lot of assemblies with it. To reduce helix payload submission size we disable it on CI. -->
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" GeneratePathProperty="true" />
     <!--
       Microsoft.Net.Test.Sdk has a dependency on Newtonsoft.Json v9.0.1. We upgrade the dependency version
       with the one used in libraries to have a consistent set of dependency versions. Additionally this works