diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2024-03-02 10:54:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-02 10:54:41 +0100 |
commit | 70bb372b45a15eb1b6a81ad8444e0d60d8521b4b (patch) | |
tree | 13d2116b1c08ba856234e29d9092c25279ea9561 | |
parent | 2ab51c6ef3fb24a625c1f4729f9b2e626a0f141b (diff) |
Don't run net4x tests with Mono on non-Windows (#98767)
* Don't run net4x tests with Mono on non-Windows
We'd try to use Mono to run them but most of the tests assume Windows when targetting net4x so they don't work anyway and you'd need to remember to pass the `-f net9.0` TFM filter.
Instead just skip them on non-Windows platforms.
Fixes https://github.com/dotnet/runtime/issues/81395
* Make AdditionalProperties more resilient against changes
* Use TargetOS instead of OS so it also works for building e.g. Browser targets on Windows
* Move logic to arcade Microsoft.DotNet.Build.Tasks
* Update eng/testing/outerBuild.targets
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
---------
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
-rw-r--r-- | eng/testing/outerBuild.targets | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/eng/testing/outerBuild.targets b/eng/testing/outerBuild.targets index c071944c21d9..6465a272bca8 100644 --- a/eng/testing/outerBuild.targets +++ b/eng/testing/outerBuild.targets @@ -1,12 +1,19 @@ <Project> - <Target Name="Test" DependsOnTargets="GetProjectWithBestTargetFrameworks"> + <Target Name="Test" DependsOnTargets="RemoveNetFrameworkProjectsOnNonWindows;GetProjectWithBestTargetFrameworks"> <MSBuild Projects="@(InnerBuildProjectsWithBestTargetFramework)" Targets="Test"> </MSBuild> </Target> - <Target Name="VSTest" DependsOnTargets="GetProjectWithBestTargetFrameworks"> + <!-- Manually remove .NET Framework projects on non-Windows: https://github.com/microsoft/vstest/issues/4908 --> + <Target Name="VSTest" DependsOnTargets="RemoveNetFrameworkProjectsOnNonWindows;GetProjectWithBestTargetFrameworks"> <MSBuild Projects="@(InnerBuildProjectsWithBestTargetFramework)" Targets="VSTest"> </MSBuild> </Target> + <Target Name="RemoveNetFrameworkProjectsOnNonWindows" Condition="'$(TargetOS)' != 'windows'"> + <PropertyGroup> + <!-- we'd try to run tests with Mono for netfx projects which doesn't work so filter them out --> + <IncludeNetFrameworkTfms>false</IncludeNetFrameworkTfms> + </PropertyGroup> + </Target> </Project>
\ No newline at end of file |