Repro:
- Create .Net solution with 2 projects. One from built-in .Net Core -> Class Library and one from .Net Core -> Unit test project templates.
- Change TargetFramework to TargetFrameworks and net462 in both projects.
- Write some tests.
- Test runner will see tests, but will not run any of them.
Tests will also fail to run if You set TargetFramework unstead of TargetFrameworks and add following package reference to main lib
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.4.0" />
This type of projects became more popular now, when people are preparing to multi-target existing projects to both full framework and .net core
Hi Yaroslav,
We have reproduced the issue with running tests based on your description. However, to make sure that the issue we are working on is the same you have faced, please send us your project or confirm that the TargetFrameworks section is looks like:
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
Thanks in advance!
Here You go. This archive contains 5 different cases with short description in name. 3 of them are buggy, and 2 works ok. Of of the cases is indeed with
<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>
in tests project, but one of the failing cases contains
<TargetFrameworks>net462</TargetFrameworks>
section.
PS: Ideally i would like to have some sort of selector if tests project(s) contains more than one TargetFramework to have abitily to run and compare test results on different Frameworks.
Many thanks.
Yaroslav.
Thank you for sharing your project. Our Test Runner handles multi-targeted projects the same way there are handled by Visual Studio - I believe that VS runs tests for the first framework in the TargetFrameworks section.
Should i open another case for this feature request then?
Yaroslav,
There is no such a necessity. I registered the following request on your behalf:
Test Runner - Make it possible to select an active target framework for multi-framework projects