If a test fails I get strange output at the end of tests for a test project
C:\Program Files\dotnet\sdk\5.0.100-preview.2.20176.6\Microsoft.TestPlatform.targets(32,5): error MSB4132: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [C:\git\coverlet\test\coverlet.core.tests\coverlet.core.tests.csproj]
It doesn't happen if I pin sdk to 3.1.201
位 dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 5.0.100-preview.2.20176.6
Commit: d752c3e07b
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-preview.2.20176.6\
Host (useful for support):
Version: 5.0.0-preview.2.20160.6
Commit: d12f79a4d1
.NET Core SDKs installed:
2.2.207 [C:\Program Files\dotnet\sdk]
3.0.103 [C:\Program Files\dotnet\sdk]
3.1.200-preview-015002 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015048 [C:\Program Files\dotnet\sdk]
5.0.100-preview.2.20176.6 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.2.20167.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Same happens for me with 3.1.400.
I think this message is a feature of msbuild that is only printed in previews. They wanted to enable it for release builds as well, but because the error was confusing they did not. At least that is what I understood from the brief mention in some meeting, but I don't know who to ask now. 馃檪
Either that or we are not following some contract correctly. https://github.com/dotnet/msbuild/issues/5508
@nohwnd
It happens for me on stable dotnet (3.1.400).
@nohwnd
It happens for me on stable dotnet (3.1.400).
_Originally posted by @Dreamescaper in https://github.com/microsoft/vstest/issues/2384#issuecomment-672127041_
dotnet 3.1.401
/usr/share/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.
Same happens with 3.1.401, but not with 3.1.202
I get this error after upgrading from 3.1 to 5.0. My test ouput (via coverlet) is as follows:
./test.ps1
Test run for F:\devt\src\19.0.core\svn\netcore\tests\bin\Debug\net5.0\tests.dll(.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.8.0-preview-20200811-01
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Microsoft.VisualStudio.TestPlatform.ObjectModel.SettingsException: Invalid settings 'RunConfiguration'. Invalid value 'net5.0' specified for 'TargetFrameworkVersion'.
at Microsoft.VisualStudio.TestPlatform.ObjectModel.RunConfiguration.FromXml(XmlReader reader)
at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetNodeValueT
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.StartTestRun(Dictionary`2 adapterSourceMap, String package, String runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler)
Test Run Aborted.
C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [F:\devt\src\19.0.core\svn\netcore\tests\tests.csproj]
@johndaintree we've seen this happen with the latest dotnet 5.0 SDKs and with Microsoft.NET.Test.Sdk nuget package in version 16.2.0 or older. Which version are you using?
This is caused by Nuget.Frameworks, change that started returning net5.0 in the DotNetFrameworkName, this change was reverted and I cannot reproduce the issue on the latest RC1 build from https://github.com/dotnet/installer#installers-and-binaries
It does not reproduce on Preview7, reproduces on Preview8 and reproduces on older versions of RC1, but not on recent versions of RC1.
@nohwnd dotnet info follows. I'm on preview 8, but I'm happy to try RC1. Looks like I'm using Microsoft.NET.Test.Sdk 16.1.0, so it's probably wise for me to update that too.
dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.100-preview.8.20417.9
Commit: fc62663a35
Runtime Environment:
OS Name: Windows
OS Version: 10.0.20201
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\
Host (useful for support):
Version: 5.0.0-preview.8.20407.11
Commit: bf456654f9
.NET SDKs installed:
1.0.4 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.100 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
5.0.100-preview.8.20417.9 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.8.20414.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [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.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.8.20407.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-preview.8.20411.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
@johndaintree yeah it will fail that way on this Preview8 build. If you get todays RC1 from dotnet/installer it will work. It will also work if you update Test.SDK to 16.3.0 or newer.
One last thing you might run into if you decide to just update is that xUnit tests are also affected by this. And will show No test is available in <assembly> Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.. Unless you are using xunit.visualstudio.runner 2.4.3 see https://github.com/dotnet/core/blob/d91069887dee1c053159333c8619d1a4039c2d53/release-notes/5.0/5.0-known-issues.md#preview-8-1
@nohwnd, thanks. I'll try all that. :)
This will continue to happen until they fix it in MSBuild, but we are setting the property, so once they fix it the message will go away.
I was getting the same error with .NET Core 3.1. Thought of sharing my experience and how I resolved it.
I ran dotnet test command with normal verbosity (appending "-v n") and found the error came because of some target mismatch between .sln and .csproj files.
I deleted the .sln file and then ran the test(via dotnet test command) and error was no more.
I can confirm that this problem went away (for me) with 5,0 RC1
Happens to me on SDK 3.1.402, too. It happens consistently when a test fails, but also intermittently when all tests pass: https://github.com/dotnet/sdk/issues/13431
Same for me, MSB4181 trying to run some tooling, an _MSBuild Task_ to _BumpAssemblyVersions_. I get the same thing trying to run against a _WindowsDesktop WinExe WinForms_ netcoreapp3.1 build.
@mwpowellhtx this should be fixed in 5.0-rc2, but will continue to happen on 3.1, there is servicing fix https://github.com/dotnet/toolset/pull/4941 up for consideration, so hopefully the committee deciding about that will approve and merge.
@nohwnd Appreciate the update, thank you. Is there anything I can do on my end? Pin a runtimeconfig.json to my tooling to avoid this embarrassing snafu? Thank you...
You can stick with older 3.1 sdk.
https://github.com/dotnet/sdk/issues/13431#issuecomment-714380033
In my case I was just missing NuGet package _Microsoft.NET.Test.Sdk_ in my solution's test project...
Most helpful comment
@nohwnd
It happens for me on stable dotnet (3.1.400).