I have a project that targets .NET Framework 4.6.1 and also .NET 5.0.
<TargetFrameworks>net461;net5.0</TargetFrameworks>
When I run all tests in the test explorer I can tell see that the number of tests is doubled because they are run for both frameworks however when I run the tests in my Azure Pipeline I can easily tell it's only running one of the target frameworks because the number of tests is cut in half.
How do I tell my Azure Pipeline (YAML) to run my tests against both frameworks?
See documentation for VSTest@2 task:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/vstest-v2?view=azure-pipelines&viewFallbackFrom=azure-devops#does-the-vstest-task-support-running-tests-that-target-multiple-target-frameworks-at-a-time
Yes, starting from version 17.3 VSTest does support running tests that target multiple target frameworks at a time. Prior to that, this wasn't possible due to a limitation from the VSTest platform side.
If you want to run tests that belong to multiple target frameworks, you'll need to install a compatible version of VSTest via Visual Studio Test Platform Installer and set vsTestVersion to toolsInstaller to use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With