Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
3e5900d
Switch to xunit3 for single file
agocke Jan 16, 2026
ad4e927
Switch to xunit3 unconditionally
agocke Jan 17, 2026
f14edd1
WIP
agocke Jan 18, 2026
104ba64
Move CBOR tests to xunit3
agocke Jan 18, 2026
27e260a
Simple name cluanup of Abstractions ns and RootNamespace chanfes
agocke Jan 18, 2026
d86dfb5
WIP
agocke Jan 19, 2026
fb4696a
WIP
agocke Jan 20, 2026
ae4b874
WIP
agocke Jan 21, 2026
e9d947f
WIP
agocke Jan 21, 2026
c09fc04
WIP
agocke Feb 25, 2026
2506b40
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Feb 25, 2026
2449ec2
Backflow from https://github.com/dotnet/dotnet / 29e2749 build 303682
dotnet-maestro[bot] Feb 28, 2026
a7f4dc6
Update dependencies from build 303682
dotnet-maestro[bot] Feb 28, 2026
fd9dc89
Merge remote-tracking branch 'upstream/darc-main-d4f68257-b103-4c5b-8…
agocke Feb 28, 2026
2db602c
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Feb 28, 2026
d7163d7
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Feb 28, 2026
c8fb448
Fix some more uses of the ConditionalTheory nameof overload
agocke Feb 28, 2026
578e86d
Run xunit v3 tests as executables instead of via dotnet exec
agocke Feb 28, 2026
d047202
Replace SkipTestException with Xunit.Sdk.SkipException
agocke Feb 28, 2026
6947ca8
Convert simple if/throw SkipException patterns to Assert.SkipWhen/Ski…
agocke Feb 28, 2026
c27315b
WIP
agocke Mar 1, 2026
ef1f6bb
Fixup more tests, and skip some System.Diagnostics tests that have di…
agocke Mar 1, 2026
e5a5759
Fix libraries xunit3 tests failing on Helix with Permission Denied
agocke Mar 1, 2026
cef6950
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Mar 1, 2026
46430e5
Fix xunit3 empty MemberData failures in crypto tests
agocke Mar 1, 2026
c838430
Fix xunit3 empty MemberData failures in crypto tests
agocke Mar 1, 2026
c58a133
Fix PerCompilationTypeAttribute for xunit v3 compatibility
agocke Mar 2, 2026
6203711
Remove obsolete build-break throws from IsolatedStorage test MemberDa…
agocke Mar 2, 2026
4fd1f09
Fix xunit3 empty MemberData in FileSystem UNC path tests
agocke Mar 2, 2026
14daea8
Fix xunit3 empty MemberData failures in VB, Immutable, and IsolatedSt…
agocke Mar 2, 2026
82dc328
Fix xunit3 test failures in Debug, Reflection, and Globalization tests
agocke Mar 2, 2026
f43ecdc
Skip DispatchProxy tests failing under xunit3 with ActiveIssue
agocke Mar 2, 2026
f658a30
Skip DCS_CollectionTypeInCollectibleALC under xunit3
agocke Mar 2, 2026
772732a
Skip SatelliteLoadsCorrectly_FromName under xunit3
agocke Mar 2, 2026
b85c0d6
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Mar 2, 2026
6f3b46e
Fix merge conflict
agocke Mar 2, 2026
d17b5a5
Fix xunit3 test failures: SqlXmlTest paths, TinyAssembly resolution, …
agocke Mar 2, 2026
a6651df
Fix xunit3 empty MemberData in RegexExperiment test
agocke Mar 5, 2026
b90e02a
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Mar 5, 2026
cb57605
Fix Tensor build errors
agocke Mar 5, 2026
fdb536b
More obsolete
agocke Mar 5, 2026
edae283
Fix up obsoletions
agocke Mar 6, 2026
8d1b4ee
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Mar 6, 2026
cafda2d
Merge remote-tracking branch 'upstream/main' into xunit3
agocke Mar 9, 2026
d6ee800
Fix xunit v3 obsolete API usages (ForMismatchedValues, ConditionalFact)
agocke Mar 9, 2026
73b6324
Fix xunit v3 migration: ConditionalTheory and Debug test failures
agocke Mar 10, 2026
82d3253
Fix xunit v3: SignatureTypes MemberData + migration docs
agocke Mar 10, 2026
398ebc0
Fix three test failures exposed by xunit v3 migration
agocke Mar 10, 2026
748749c
Fix Wasm.Build.Tests xunit v3 migration
agocke Mar 10, 2026
e484bf5
Fix xunit v3 migration build errors
agocke Mar 11, 2026
c462353
Fix NETSDK1084 on android, ILVerification.Tests xunit v3, remove stal…
agocke Mar 11, 2026
8eab22a
Fix xunit v3 namespace conflicts in 5 more test projects
agocke Mar 11, 2026
94499f8
Fix xunit v3 UseAppHost, validation, and CLI argument issues
agocke Mar 11, 2026
3c7732f
Fix WASM/mobile/NativeAOT xunit v3 build issues
agocke Mar 11, 2026
f59c85d
Fix UseAppHost for mobile/WASM/NativeAOT and ILLink descriptor
agocke Mar 11, 2026
790abcb
Fix NETSDK1067 for WASM/mobile SelfContained and NETSDK1150 for Nativ…
agocke Mar 11, 2026
6f0b123
Fix NET481 test runner, NativeAOT rd.xml, ThreadPool namespace, NETSD…
agocke Mar 11, 2026
543b9eb
Use Microsoft.DotNet.XUnitAssert for .NETCoreApp targets
agocke Mar 20, 2026
6c1aae0
Merge upstream/main into xunit3
agocke Mar 20, 2026
74ba9e0
Merge upstream/main into xunit3
agocke Mar 20, 2026
4f00ef5
Fix CI build failures from upstream merge
agocke Mar 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 17 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@
<Import Project="$(RepositoryEngineeringDir)packaging.targets" Condition="'$(IsPackable)' == 'true' and '$(MSBuildProjectExtension)' != '.pkgproj'" />
<Import Project="$(RepositoryEngineeringDir)slngen.targets" Condition="'$(IsSlnGen)' == 'true'" />

<!--
The xunit.v3.core.mtp-v1 NuGet package unconditionally sets UseAppHost=true
in its buildTransitive props and validates it in its buildTransitive targets.
Test projects in dotnet/runtime don't need an apphost (tests are run via
dotnet exec or the Helix test runner). Override UseAppHost here, in
Directory.Build.targets, which is imported after the NuGet package targets.
Library tests also have an override in eng/testing/xunit/xunit.targets.
-->
<PropertyGroup Condition="'$(IsTestProject)' == 'true' and '$(TestSingleFile)' != 'true'">
<UseAppHost>false</UseAppHost>
<_RuntimeIdentifierUsesAppHost Condition="'$(SelfContained)' == 'true'">false</_RuntimeIdentifierUsesAppHost>
</PropertyGroup>
<Target Name="_XunitValidateBuild" BeforeTargets="BeforeBuild" Condition=" '$(TargetFramework)' != '' AND '$(IsTestProject)' == 'true' ">
<Error Text="xUnit.net v3 test projects must be executable (set project property '&lt;OutputType&gt;Exe&lt;/OutputType&gt;')."
Condition=" '$(OutputType)' != 'Exe' AND '$(TargetsMobile)' != 'true' " />
</Target>

<PropertyGroup>
<NetCoreAppCurrentBuildSettings>$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NetCoreAppCurrentBuildSettings>
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrentBuildSettings)'))</NativeBinDir>
Expand Down
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
one as a template. The following line is a marker to insert the test restore sources.
-->
<!-- TEST_RESTORE_SOURCES_INSERTION_LINE -->
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
Expand Down
6 changes: 6 additions & 0 deletions docs/workflow/testing/libraries/filtering-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ A common usage in the libraries tests is the following:

This is put on test classes to indicate that none of the tests in that class (which as usual run serially with respect to each other) may run concurrently with tests in another class. This is used for tests that use a lot of disk space or memory, or dominate all the cores, such that they are likely to disrupt any tests that run concurrently.

## xunit v3 Migration

For xunit v3–specific patterns (empty `[MemberData]`, `ConditionalTheory`
migration, non-serializable test data), see the
[xunit v3 Migration Notes](xunit3-migration.md).

## FactAttribute and `Skip`

Another way to disable the test entirely is to use the `Skip` named argument that is used on the `FactAttribute`.
Expand Down
175 changes: 175 additions & 0 deletions docs/workflow/testing/libraries/xunit3-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# xunit v3 Migration Notes

This document covers common issues and patterns encountered when migrating
tests from xunit v2 to xunit v3.

## Empty `[MemberData]` at Runtime

In xunit v3, a `[Theory]` whose `[MemberData]` source returns **zero rows**
is a hard failure ("No data found"), not a silent no-op. When running through
the test harness this surfaces as:

```
[FATAL ERROR] System.InvalidOperationException
Cannot find test case metadata for ID <sha256-hash>
```

This commonly happens when:

- A `[MemberData]` source filters its output based on platform support
(e.g., `Where(x => SomeAlgorithm.IsSupported)`) and all items are
filtered out on the current platform.
- A `[MemberData]` source **throws during enumeration** (e.g., because an
object in the test data does not support `GetHashCode()`). The
`ModifiedType` returned by `GetModifiedFieldType()` is a known example —
it throws `NotSupportedException` from `GetHashCode()`.

### Diagnosing

Run the test assembly directly with `-list full` to map the failing ID to a
test method name:

```bash
# Use the testhost dotnet, not the system one
artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec \
artifacts/bin/<TestProject>/Debug/net11.0-unix/<TestProject>.dll \
-list full 2>&1 | grep <sha256-hash>
```

Then inspect the `[MemberData]` source for conditional logic or types that
cannot be serialized/hashed by xunit v3.

### Fixing Empty Data

Switch to an unconditional data source and move the platform check into the
test body:

```cs
// BROKEN: MemberData can return zero rows
public static IEnumerable<object[]> SupportedAlgorithmsTestData =>
AllAlgorithms.Where(a => MyAlgorithm.IsSupported(a)).Select(a => new object[] { a });

[Theory]
[MemberData(nameof(SupportedAlgorithmsTestData))]
public void MyTest(MyAlgorithm algorithm) { /* ... */ }
```

```cs
// FIXED: MemberData always returns rows; skip at runtime
public static IEnumerable<object[]> AllAlgorithmsTestData =>
AllAlgorithms.Select(a => new object[] { a });

[Theory]
[MemberData(nameof(AllAlgorithmsTestData))]
public void MyTest(MyAlgorithm algorithm)
{
Assert.SkipUnless(MyAlgorithm.IsSupported(algorithm), "Not supported on this platform.");
/* ... */
}
```

### Fixing Non-Serializable Data

When test data contains types that xunit v3 cannot serialize or hash (e.g.,
`ModifiedType` from `GetModifiedFieldType()`), pass simple identifiers
through `[InlineData]` and construct the problematic objects inside the test
body:

```cs
// BROKEN: ModifiedType throws NotSupportedException from GetHashCode()
public static IEnumerable<object[]> TestData
{
get
{
yield return [someSignatureType, typeof(Foo).GetField("Bar").GetModifiedFieldType()];
}
}

[Theory]
[MemberData(nameof(TestData))]
public void MyTest(Type signatureType, Type reflectedType) { /* ... */ }
```

```cs
// FIXED: pass field name, construct ModifiedType in test body
[Theory]
[InlineData(nameof(Foo.Bar))]
public void MyTest(string fieldName)
{
Type reflectedType = typeof(Foo).GetField(fieldName).GetModifiedFieldType();
Type signatureType = /* construct based on fieldName */;
/* ... */
}
```

## `ConditionalTheory` → `[Theory]` + `Assert.SkipUnless`

`[ConditionalTheory]` from `Microsoft.DotNet.XUnitExtensions` evaluates its
conditions **before** enumerating `[MemberData]`. If the condition is false,
the entire theory is skipped without touching test data.

When migrating to plain `[Theory]`, move the condition into the test body
using `Assert.SkipUnless`:

```cs
// Before (xunit v2 / ConditionalTheory)
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsFeatureSupported))]
[MemberData(nameof(MyTestData))]
public void MyTest(int x) { /* ... */ }

// After (xunit v3)
[Theory]
[MemberData(nameof(MyTestData))]
public void MyTest(int x)
{
Assert.SkipUnless(PlatformDetection.IsFeatureSupported, "Requires IsFeatureSupported");
/* ... */
}
```

**Important**: Ensure the `[MemberData]` source does not depend on the same
condition. If it does, refactor the data source to always return rows (see
[Fixing Empty Data](#fixing-empty-data) above).

## `ConditionalFact` → `[Fact]` + `Assert.SkipUnless`

The same pattern applies:

```cs
// Before
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsFeatureSupported))]
public void MyTest() { /* ... */ }

// After
[Fact]
public void MyTest()
{
Assert.SkipUnless(PlatformDetection.IsFeatureSupported, "Requires IsFeatureSupported");
/* ... */
}
```

## `EqualException.ForMismatchedValues` Signature Change

In xunit v3, `EqualException.ForMismatchedValues` requires `string`
parameters instead of `object`. Calls that previously passed arbitrary
objects must now call `.ToString()`:

```cs
// Before (xunit v2)
throw EqualException.ForMismatchedValues(expected, actual, banner);

// After (xunit v3)
throw EqualException.ForMismatchedValues(expected.ToString(), actual.ToString(), banner);
```

## Runner Configuration

The test runner configuration is in `eng/testing/xunit/xunit.runner.json`.
Key settings for the migration:

- `"preEnumerateTheories": false` — theories are **not** pre-enumerated at
discovery time. Data is enumerated at runtime. This means `[MemberData]`
sources are called during execution, not discovery.
- `"diagnosticMessages": true` — enables diagnostic output for debugging
discovery and execution issues.
2 changes: 1 addition & 1 deletion eng/Version.Details.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This file should be imported by eng/Versions.props
<MicrosoftDotNetRemoteExecutorPackageVersion>11.0.0-beta.26166.111</MicrosoftDotNetRemoteExecutorPackageVersion>
<MicrosoftDotNetSharedFrameworkSdkPackageVersion>11.0.0-beta.26166.111</MicrosoftDotNetSharedFrameworkSdkPackageVersion>
<MicrosoftDotNetXliffTasksPackageVersion>11.0.0-beta.26166.111</MicrosoftDotNetXliffTasksPackageVersion>
<MicrosoftDotNetXUnitAssertPackageVersion>2.9.3-beta.26166.111</MicrosoftDotNetXUnitAssertPackageVersion>
<MicrosoftDotNetXUnitAssertPackageVersion>3.2.2-beta.26168.106</MicrosoftDotNetXUnitAssertPackageVersion>
<MicrosoftDotNetXUnitConsoleRunnerPackageVersion>2.9.3-beta.26166.111</MicrosoftDotNetXUnitConsoleRunnerPackageVersion>
<MicrosoftDotNetXUnitExtensionsPackageVersion>11.0.0-beta.26166.111</MicrosoftDotNetXUnitExtensionsPackageVersion>
<MicrosoftNetCompilersToolsetPackageVersion>5.6.0-2.26166.111</MicrosoftNetCompilersToolsetPackageVersion>
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>3ccdcc4cf9b93bf3504275d4506144cf68c15b2c</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XUnitAssert" Version="2.9.3-beta.26166.111">
<Dependency Name="Microsoft.DotNet.XUnitAssert" Version="3.2.2-beta.26168.106">
<Uri>https://github.com/dotnet/dotnet</Uri>
<Sha>3ccdcc4cf9b93bf3504275d4506144cf68c15b2c</Sha>
<Sha>803eb28628f5623c108f1bf33504c86e19815821</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="11.0.0-beta.26166.111">
<Uri>https://github.com/dotnet/dotnet</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<MoqVersion>4.18.4</MoqVersion>
<MicrosoftDiagnosticsRuntimeVersion>3.1.512801</MicrosoftDiagnosticsRuntimeVersion>
<AwesomeAssertionsVersion>8.0.2</AwesomeAssertionsVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<FsCheckVersion>3.3.2</FsCheckVersion>
<CommandLineParserVersion>2.9.1</CommandLineParserVersion>
<CompilerPlatformTestingVersion>1.1.3-beta1.24423.1</CompilerPlatformTestingVersion>
<CompilerPlatformTestingDiffPlexVersion>1.7.2</CompilerPlatformTestingDiffPlexVersion>
Expand Down
28 changes: 6 additions & 22 deletions eng/testing/ILLink.Descriptor.xunit.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
<!-- xunit 2.x version is not under development. We make xunit trimming compatible in methods which ILLink cannot track by providing XML descriptor to keep the dependencies -->
<!-- xunit v3 trimming descriptor: preserve assemblies that ILLink cannot statically track -->
<linker>
<assembly fullname="xunit.execution.dotnet">
<type fullname="Xunit.Sdk.ReflectionAssemblyInfo">
<method signature="System.Void .ctor(System.String)" />
</type>
<type fullname="Xunit.Sdk.TestFrameworkProxy">
<method signature="System.Void .ctor(System.Object,System.Object,System.Object)" />
</type>
<type fullname="Xunit.Sdk.FactDiscoverer" />
<type fullname="Xunit.Sdk.CollectionPerAssemblyTestCollectionFactory" />
</assembly>
<assembly fullname="Microsoft.DotNet.XUnitExtensions" />
<assembly fullname="xunit.core">
<namespace fullname="Xunit" />
<namespace fullname="Xunit.Sdk" />
</assembly>
<assembly fullname="xunit.assert">
<type fullname="Xunit.Sdk.CollectionTracker">
<method name="CompareTypedSets" />
</type>
</assembly>
<assembly fullname="xunit.runner.utility.netcoreapp10" />
<assembly fullname="xunit.v3.mtp-v1" />
<assembly fullname="Microsoft.DotNet.XUnitV3Extensions" />
<assembly fullname="xunit.v3.assert" />

Check failure on line 5 in eng/testing/ILLink.Descriptor.xunit.xml

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release LibraryTests_Smoke_AOT)

eng/testing/ILLink.Descriptor.xunit.xml#L5

eng/testing/ILLink.Descriptor.xunit.xml(5,4): error IL2007: (NETCORE_ENGINEERING_TELEMETRY=Build) Could not resolve assembly 'xunit.v3.assert'.
<assembly fullname="Microsoft.DotNet.XUnitAssert" />

Check failure on line 6 in eng/testing/ILLink.Descriptor.xunit.xml

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release LibraryTests_Smoke_AOT)

eng/testing/ILLink.Descriptor.xunit.xml#L6

eng/testing/ILLink.Descriptor.xunit.xml(6,4): error IL2007: (NETCORE_ENGINEERING_TELEMETRY=Build) Could not resolve assembly 'Microsoft.DotNet.XUnitAssert'.
<assembly fullname="xunit.v3.runner.common" />
</linker>
2 changes: 2 additions & 0 deletions eng/testing/RunnerTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ set EXECUTION_DIR=%~dp0
:: Assume failure
set HAS_TEST_RESULTS=0

set DOTNET_ROOT=%RUNTIME_PATH%

:: Support for SuperPMI collection
REM SuperPMI collection
if not defined spmi_enable_collection goto :skip_spmi_enable_collection
Expand Down
2 changes: 2 additions & 0 deletions eng/testing/RunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ if [[ -z "$RUNTIME_PATH" ]]; then
exit -1
fi

export DOTNET_ROOT="$RUNTIME_PATH"

exitcode_list[0]="Exited Successfully"
exitcode_list[130]="SIGINT Ctrl-C occurred. Likely tests timed out."
exitcode_list[131]="SIGQUIT Ctrl-\ occurred. Core dumped."
Expand Down
4 changes: 2 additions & 2 deletions eng/testing/tests.singlefile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(CommonTestPath)SingleFileTestRunner\SingleFileTestRunner.cs"
<!-- <Compile Include="$(CommonTestPath)SingleFileTestRunner\SingleFileTestRunner.cs"
Link="Common\SingleFileTestRunner\SingleFileTestRunner.cs"
Condition="'$(CLRTestKind)' == '' and '$(IsFunctionalTest)' != 'true'" />
Condition="'$(CLRTestKind)' == '' and '$(IsFunctionalTest)' != 'true'" /> -->
</ItemGroup>

<ItemGroup>
Expand Down
33 changes: 20 additions & 13 deletions eng/testing/xunit/xunit.console.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,33 @@
<SetScriptCommands Include="$(EnvVarCommand) XUNIT_HIDE_PASSING_OUTPUT_DIAGNOSTICS=1" />
</ItemGroup>

<!-- xunit v3: The test executable needs execute permission on Unix after ZIP extraction on Helix. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
'$(RunScriptWindowsCmd)' != 'true' and
'$(TargetsMobile)' != 'true' and
'$(TestSingleFile)' != 'true'">
<SetScriptCommands Include="chmod +x $EXECUTION_DIR/$(AssemblyName)" />
</ItemGroup>

<PropertyGroup Condition="'$(BundleXunitRunner)' == 'true'">
<XunitConsolePath Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">xunit.console.dll</XunitConsolePath>
<XunitConsolePath Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">xunit.console.exe</XunitConsolePath>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsMobile)' != 'true' and '$(TestSingleFile)' != 'true'">
<_depsFileArgument Condition="'$(GenerateDependencyFile)' == 'true'">--depsfile $(AssemblyName).deps.json</_depsFileArgument>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">"$(RunScriptHost)" exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileArgument) $(XunitConsolePath)</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">$(XunitConsolePath)</RunScriptCommand>
<!--
xunit v3: All test projects (both .NETCoreApp and .NETFramework) produce
executables with an embedded in-process runner. Run them directly.
-->
<RunScriptCommand Condition="'$(RunScriptWindowsCmd)' != 'true'">./$(AssemblyName)</RunScriptCommand>
<RunScriptCommand Condition="'$(RunScriptWindowsCmd)' == 'true'">$(AssemblyName).exe</RunScriptCommand>

<RunScriptCommand>$(RunScriptCommand) $(TargetFileName)</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) -xml $(TestResultsName)</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) -nologo</RunScriptCommand>
<RunScriptCommand Condition="'$(ArchiveTests)' == 'true'">$(RunScriptCommand) -nocolor</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) -noLogo</RunScriptCommand>
<RunScriptCommand Condition="'$(ArchiveTests)' == 'true'">$(RunScriptCommand) -noColor</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(TestDisableAppDomain)' == 'true'">$(RunScriptCommand) -noappdomain</RunScriptCommand>
<RunScriptCommand Condition="'$(TestDisableParallelization)' == 'true'">$(RunScriptCommand) -maxthreads 1</RunScriptCommand>
<RunScriptCommand Condition="'$(XUnitShowProgress)' == 'true'">$(RunScriptCommand) -verbose</RunScriptCommand>
<RunScriptCommand Condition="'$(TestDisableParallelization)' == 'true'">$(RunScriptCommand) -maxThreads 1</RunScriptCommand>
<RunScriptCommand Condition="'$(XUnitShowProgress)' == 'true'">$(RunScriptCommand) -reporter verbose</RunScriptCommand>
</PropertyGroup>

<PropertyGroup Condition="'$(UseXunitExcludesTxtFile)' != 'true'">
Expand All @@ -42,7 +52,7 @@

<!-- Add to run argument string -->
<RunScriptCommand>$(RunScriptCommand)$(_withCategories.Replace(';', ' -trait category='))</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand)$(_withoutCategories.Replace(';', ' -notrait category='))</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand)$(_withoutCategories.Replace(';', ' -trait- category='))</RunScriptCommand>

<!-- User passed in options. -->
<RunScriptCommand Condition="'$(XUnitOptions)' != ''">$(RunScriptCommand) $(XUnitOptions)</RunScriptCommand>
Expand All @@ -58,9 +68,6 @@
</PropertyGroup>

<ItemGroup Condition="'$(TestSingleFile)' != 'true'">
<PackageReference Include="Microsoft.DotNet.XUnitConsoleRunner"
Version="$(MicrosoftDotNetXUnitConsoleRunnerVersion)"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<PackageReference Include="xunit.runner.console"
Version="$(XUnitVersion)"
GeneratePathProperty="true"
Expand All @@ -83,7 +90,7 @@
</Target>

<!-- ResolveAssemblyReferences is the target that populates ReferenceCopyLocalPaths which is what is copied to output directory. -->
<Target Name="CopyRunnerToOutputDirectory" BeforeTargets="ResolveAssemblyReferences" Condition="'$(BundleXunitRunner)' == 'true'">
<Target Name="CopyRunnerToOutputDirectory" BeforeTargets="ResolveAssemblyReferences" Condition="'$(BundleXunitRunner)' == 'true' and '$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<ItemGroup>
<None Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\*"
Exclude="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))\xunit.console.*exe.config;
Expand Down
Loading
Loading