nuke-build / nuke

🏗 The AKEless Build System for C#/.NET
https://nuke.build
MIT License
3.08k stars 372 forks source link

`Xunit2Tasks.Xunit2` cannot run tests with v9 #1475

Closed IT-VBFK closed 1 day ago

IT-VBFK commented 1 day ago

Usage Information

9.0.1 / 8.0.404 / .net8.0 / Win

Description

Since v9 the Xunit2 method from XunitTasks cannot run tests anymore. It always tells that it can't find/load xunit.execution.dotnet.dll.

21:13:19 [DBG] xUnit.net Console Runner v2.9.2+82543a6df6 (64-bit .NET 6.0.35)
21:13:20 [DBG] System.InvalidOperationException: Could not find/load any of the following assemblies: xunit.execution.dotnet.dll
21:13:20 [DBG] System.InvalidOperationException: Could not find/load any of the following assemblies: xunit.execution.dotnet.dll
21:13:20 [DBG] System.InvalidOperationException: Could not find/load any of the following assemblies: xunit.execution.dotnet.dll

The exception message + stacktrace:

21:19:28 [ERR] Target UnitTestsNet47 has thrown an exception
System.Exception: One or more of the tests failed
   at Nuke.Common.Tools.Xunit.XunitTasks.<>c.<GetExitHandler>b__8_0(ToolOptions _, IProcess p) in /_/source/Nuke.Common/Tools/Xunit/XunitTasks.cs:line 26
   at Nuke.Common.Tooling.ToolTasks.<>c__DisplayClass7_0.<GetExitHandlerInternal>b__3(ToolOptions o, IProcess p) in /_/source/Nuke.Tooling/ToolTasks.ExitHandler.cs:line 22
   at Nuke.Common.Tooling.ToolTasks.Run(ToolOptions options) in /_/source/Nuke.Tooling/ToolTasks.Run.cs:line 32
   at Nuke.Common.Tools.Xunit.XunitTasks.Xunit2(Configure`1 configurator) in /_/source/Nuke.Common/Tools/Xunit/Xunit.Generated.cs:line 36
   at Build.<get_UnitTestsNet47>b__35_2() in F:\Projekte\fluentassertions\Build\Build.cs:line 176
   at Nuke.Common.Execution.BuildExecutor.<>c.<Execute>b__4_2(Action x) in /_/source/Nuke.Build/Execution/BuildExecutor.cs:line 120
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Nuke.Common.Execution.BuildExecutor.Execute(NukeBuild build, ExecutableTarget target, IReadOnlyCollection`1 previouslyExecutedTargets, Boolean failureMode) in /_/source/Nuke.Build/Execution/BuildExecutor.cs:line 120

Reproduction Steps

1) Update NUKE in https://github.com/fluentassertions/fluentassertions to v9 2) Adopt breaking changes 3) Either run the build project via VS/Rider or via build.cmd 4) See the error on Target UnitTestsNet47

Expected Behavior

Runs this tasks without problems, like it does in v8

Actual Behavior

Does not

Regression?

yes

Known Workarounds

No response

Could you help with a pull-request?

No

matkoch commented 1 day ago

this is after invocation, so almost certainly not related to nuke

IT-VBFK commented 1 day ago

Hmm.. but it doesn't work on CI either: see this last run https://github.com/fluentassertions/fluentassertions/actions/runs/12106943863/job/33753263991

And here the latest develop (which is nuke 8): https://github.com/fluentassertions/fluentassertions/actions/runs/12106420603/job/33752144957

The difference is, that with v9 it tries to resolve to net6.0 (ignoring the .SetFramework("net47") which I consider at least an indication that something has changed inside NUKE.

Indeed: this commit removing the Framework option which was introduced with this commit