MSTest V2 tests won't run when targeting net5.0-windows10.0.19041
See original GitHub issueDescription
Tests will not run when targeting net5.0-windows10.0.19041 with MSTest version greater than 2.2.3.
Steps to reproduce
- Create MSTest project targeting net5.0-windows10.0.19041.
- Attempt to run tests
- Change MSTest version to 2.2.3
- Clean solution and run tests again
Expected behavior
Tests should run in the test explorer
Actual behavior
All tests are skipped. VS Test log incorrectly reports .dll does not exist.
VS Test Log Output:
[MSTest][Discovery][WinUI3-Demo\WinUI3-UnitTests\bin\Debug\net5.0-windows10.0.19041\WinUI3-UnitTests.dll] Failed to discover tests from assembly WinUI3-Demo\WinUI3-UnitTests\bin\Debug\net5.0-windows10.0.19041\WinUI3-UnitTests.dll. Reason:File does not exist: WinUI3-Demo\WinUI3-UnitTests\bin\Debug\net5.0-windows10.0.19041\WinUI3-UnitTests.dll
MSTest log:
pTrace Information: 0 : 4580, 4, 2021/10/01, 16:05:24.725, 12341249999384, testhost.x86.dll, AssemblyResolver.OnResolve: Resolved assembly: Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices, from path: \WinUI3-Demo\WinUI3-UnitTests\bin\Debug\net5.0-windows10.0.19041\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
TpTrace Information: 0 : 4580, 4, 2021/10/01, 16:05:24.725, 12341250002103, testhost.x86.dll, MSTestExecutor.RunTests: Running tests from sources.
TpTrace Information: 0 : 4580, 4, 2021/10/01, 16:05:24.728, 12341250024421, testhost.x86.dll, CollectSourceInformation value Found : False
TpTrace Error: 0 : 4580, 4, 2021/10/01, 16:05:24.773, 12341250480636, testhost.x86.dll, Exception of type 'System.InvalidOperationException' was thrown.
Environment
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.5" />
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top Results From Across the Web
MSTest v2 won't run with net5.0-windows
I am able to run tests through the test explorer when targeting .NET 5.0. Project Reunion requires net5.0-windows10.0.19041 as the target ...
Read more >Troubleshoot .NET Framework targeting errors
This article provides resolutions for MSBuild errors that might occur because of reference issues.
Read more >Test explorer doesn't display/run tests for multiple target ...
I have created a simple class library that targets NETSTANDARD2.0 and NET461. ... dotnet test runs both targets with the NET461 version failing...
Read more >Problems with .NET unit testing
JetBrains Rider automatically detects unit tests and provides a unit test runner to run and debug them. We are continuously improving unit testing...
Read more >Unit Testing Maui with Esri 100.14.0.Preview2 with Xunit
If you for instance run your unit tests on Windows, just add the '-windows10.0.19041' to your target framework for your unit test project....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Haplois is there anything we can do to help get this fixed in a next version?
I am currently working on fixing this. Our next preview (probably on next friday) will include a fix. I’ll update this thread with PR once it is ready. @japj thank you for the offer.