dotnet test error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error
See original GitHub issueWhen running NUnit tests using dotnet test
I sometimes get the following error at the end of the test run:
C:\Program Files\dotnet\sdk\3.1.401\Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [C:\W ork\Play\TestFailureTest\TestFailureTest.csproj]
This seems to always happen when at least one test failed. I have occasionally seen the same error when all tests pass on our TeamCity build servers, but cannot reproduce that. Output with a failing test, with the attached trivial test project:
C:\W ork\Play\TestFailureTest>dotnet test
Test run for C:\W ork\Play\TestFailureTest\bin\Debug\netcoreapp3.1\TestFailureTest.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.7.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
X FailingTest [39ms]
Error Message:
This is a test failure message
Stack Trace:
at TestFailureTest.Tests.FailingTest() in C:\W ork\Play\TestFailureTest\Tests.cs:line 11
Test Run Failed.
Total tests: 1
Failed: 1
Total time: 0.9542 Seconds
C:\Program Files\dotnet\sdk\3.1.401\Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [C:\W ork\Play\TestFailureTest\TestFailureTest.csproj]
Happened both on Windows 7 and on a Linux (Mint 19) VM.
dotnet --info on Windows:
.NET Core SDK (reflecting any global.json):
Version: 3.1.401
Commit: 5b6f5e5005
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.401\
Host (useful for support):
Version: 3.1.7
Commit: fcfdef8d6b
.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.107 [C:\Program Files\dotnet\sdk]
3.1.400 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
and on Linux:
.NET Core SDK (reflecting any global.json):
Version: 3.1.401
Commit: 39d17847db
Runtime Environment:
OS Name: linuxmint
OS Version: 19
OS Platform: Linux
RID: linuxmint.19-x64
Base Path: /usr/share/dotnet/sdk/3.1.401/
Host (useful for support):
Version: 3.1.7
Commit: fcfdef8d6b
.NET Core SDKs installed:
2.1.809 [/usr/share/dotnet/sdk]
3.1.401 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:34 (9 by maintainers)
Top Results From Across the Web
MSB4181: The 'task' task returned false but did not log an ...
This error occurs when a task returned false without logging an error. This indicates a failure from a task that did not report...
Read more >DotNet Test build step causes build to fail even if failing ...
TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error.
Read more >Issue with DotNetCoreCLI@2 task - Developer Community
TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error.
Read more >dotnet test error MSB4181: The "Microsoft.TestPlatform. ...
dotnet test error MSB4181 : The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error.
Read more >Use Microsoft.TestPlatform.Build.Tasks.VSTestTask in ...
TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks. VSTestTask " task returned false but did not log an error.
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 Free
Top 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
Everything is red in our CI thanks to this problem. And you cannot expect every company to take risks on RC versions of the next SDK. Any updates on this?
any updates on this? We have the same issue