Repository navigation
Closed
Description
When using Microsoft Testing Platform, the reference to the Microsoft.NET.Test.Sdk package is no longer required.
For example, that's the quote from Xunit docs:
If you want to rely solely on Microsoft Testing Platform support, you can remove the package references to xunit.runner.visualstudio and Microsoft.NET.Test.Sdk.
But JunitXml.TestLogger implicitly requires the Microsoft.NET.Test.Sdk, because if we run tests on a project that does not have such a reference the following error occurs:
Error output: Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Spekt.TestLogger.Core.TestResultStore..ctor() in /home/runner/work/testlogger/testlogger/src/TestLogger/Core/TestResultStore.cs:line 10
at Spekt.TestReporter.TestReporter.CreateTestRun(IServiceProvider serviceProvider) in /home/runner/work/testlogger/testlogger/src/TestLogger/TestReporter.cs:line 160
at Spekt.TestReporter.TestReporter.IsEnabledAsync() in /home/runner/work/testlogger/testlogger/src/TestLogger/TestReporter.cs:line 81
at Microsoft.Testing.Platform.TestHost.TestHostManager.BuildDataConsumersAsync(ServiceProvider serviceProvider, List`1 alreadyBuiltServices) in /_/src/Platform/Microsoft.Testing.Platform/TestHost/TestHostManager.cs:line 177
at Microsoft.Testing.Platform.Hosts.TestHostBuilder.BuildTestFrameworkAsync(TestFrameworkBuilderData testFrameworkBuilderData) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/TestHostBuilder.cs:line 682
at Microsoft.Testing.Platform.Hosts.ConsoleTestHost.InternalRunAsync(CancellationToken cancellationToken) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/ConsoleTestHost.cs:line 56
at Microsoft.Testing.Platform.Hosts.CommonHost.RunTestAppAsync(CancellationToken testApplicationCancellationToken) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs:line 115
at Microsoft.Testing.Platform.Hosts.CommonHost.RunAsync() in /_/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs:line 54
at Microsoft.Testing.Platform.Hosts.CommonHost.RunAsync() in /_/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs:line 62
at Microsoft.Testing.Platform.Hosts.CommonHost.RunAsync() in /_/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs:line 74
at Microsoft.Testing.Platform.Builder.TestApplication.RunAsync() in /_/src/Platform/Microsoft.Testing.Platform/Builder/TestApplication.cs:line 227
at Xunit.MicrosoftTestingPlatform.TestPlatformTestFramework.RunAsync(String[] args, Action`2 extensionRegistration) in /_/src/common/MicrosoftTestingPlatform/TestPlatformTestFramework.cs:line 334
at Records.UnitTests.AutoGenerated.XunitAutoGeneratedEntryPoint.Main(String[] args) in /builds/cloud/dss/tests/UnitTests/AuditService/Records.UnitTests/obj/Debug/net10.0/XunitAutoGeneratedEntryPoint.cs:line 13
Is it possible to remove such a reference for MTPv2 mode?
- Test Runner: MTPv2
- Test Framework: Xunit
- .NET project version, sdk version: net10.0
- Command line used (please share the test run command):
dotnet test --solution audit.slnx --report-spekt-junit "MethodFormat=Class;FailureBodyFormat=Verbose;" --report-spekt-junit-filename "$ROOT/artifacts/tests/{assembly}-test-result.xml" --filter-query "/!*IntegrationTests"
- OS: Linux/Windows
Expected behavior
No errors occur during test run.
Reacted by Matyáš Bach, Evgeny Valavin, Fasjeit, Mark Preston, cs-KrisDeBeukeleer and Morten Brix Pedersen
Metadata
Metadata
Assignees
Labels
No labels
Activity
evgenyvalavin commentedon Apr 3, 2026
The same issue for me.
I managed to solve the issue with only installing Microsoft.TestPlatform.ObjectModel NuGet. But still this package dependency looks strange, as it is not related to MTP, but rather to VSTest
I have no Microsoft.NET.Test.Sdk in my project.
.NET 8
xunit.v3. 4.0.0
pinkfloydx33 commentedon Apr 19, 2026
Same issue with xunit.v3.mtp-v2
mbp commentedon Aug 31, 2026
Now that xunit is at 4.0.0, I am unable to use junit testlogger, as
--report-junitneeds to be replaced by--report-spekt-junitand this causes the exception in this issue: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.feat: decouple vstest and mtp workflows. See #229 (#245)
codito commentedon Sep 3, 2026
Please test the pre-release package (v8.1.1-pre*) available in myget feed.
codito commentedon Oct 24, 2026
Published 8.1.0 to nuget.