Reputation: 1604
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?
Upvotes: 4
Views: 959
Reputation: 76
See documentation for VSTest@2 task:
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.
Upvotes: 4