✅ dotnet test: Testing with VSTest target is no longer supported by Microsoft.Testing.Platform
Running
dotnet test produces the following error:
I am using TUnit, and it is constructed on top of Microsoft.Testing.Platform, any idea what might be going on?
I checked the link, and gloabl.json includes the necessary config
19 Replies
what version of
Microsoft.Testing.Platform does it use?v2.0.1
what error code does it have? - not just the message
❯ dotnet test
Restore complete (1.6s)
UaDetector.Abstractions.Tests failed with 1 error(s) (0.0s)
/home/nandor/.nuget/packages/microsoft.testing.platform.msbuild/2.0.1/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets(263,5): error Testing with VSTest target is no longer supported by Microsoft.Testing.Platform on .NET 10 SDK and later. If you use dotnet test, you should opt-in to the new dotnet test experience. For more information, see https://aka.ms/dotnet-test-mtp-error
Build failed with 1 error(s) in 2.3s
Testing with 'dotnet test' - .NET
Learn more about how 'dotnet test' works and its support for VSTest and Microsoft.Testing.Platform (MTP)
This is the output, no error, looks like
global.json is not respectedI assume you have the global.json in the project directory or above, and haven't overridden it with another one closer to the project?
there is a single global.json at root level, also the sdk
"allowPrerelease": true takes effect
test config seems to be ignored
yes, there's no overridingtry adding
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner> to the test project csproj @Core
and then try also adding <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport> maybe if that doesn't work
also, ensure the OutputType is Exe I think is what you want for MTP, could be that also, not sure
once you get it working, you can remove the unnecessary changesThis is the csproj
where do you set package version?
I also tried adding
UseMicrosoftTestingPlatformRunner, but same result
I'm using central package managerare you running dotnet test on the project, or the solution btw?
It is odd, because tests execute from the IDE, but fail from command line
on this specific project
maybe try solution just in case, but probably won't work
it doesnt :Smadge:
try
dotnet test --project my.csproj
(but with correct file name ofc)hmm, why is it still using vstest lol
have you got the global.json next to the sln or next to the csproj?
(try putting it next to the sln, which is hopefully in a dir or 2 above the csproj, if not)
anyway, it's late for me so I'm going to go to bed - hope you can get it working 🙂
Alright, thanks for the help
Problem solved, I had to update .net 10 rc1 to rc2