Skip to content

Migrate MSI and misc test projects to MSTest.Sdk on MTP#54882

Merged
Evangelink merged 3 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-msi-misc
Jun 22, 2026
Merged

Migrate MSI and misc test projects to MSTest.Sdk on MTP#54882
Evangelink merged 3 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-msi-misc

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates the MSI and miscellaneous test projects from xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), following the established repo pattern.

Projects:

  • Microsoft.Win32.Msi.Tests
  • Microsoft.Win32.Msi.Manual.Tests
  • msbuild.Integration.Tests
  • Microsoft.WebTools.AspireService.Tests

Part of the xUnit -> MSTest migration effort. Each project builds cleanly; tests were not run as part of this change.

Migrates the following to MSTest.Sdk (Microsoft.Testing.Platform):
- Microsoft.Win32.Msi.Tests
- Microsoft.Win32.Msi.Manual.Tests
- msbuild.Integration.Tests
- Microsoft.WebTools.AspireService.Tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 19, 2026 08:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates several SDK test projects from xUnit to MSTest.Sdk (Microsoft.Testing.Platform), aligning them with the repo’s MSTest migration pattern and updating test attributes/assertions accordingly.

Changes:

  • Convert msbuild.Integration.Tests, Microsoft.Win32.Msi.Tests, and Microsoft.WebTools.AspireService.Tests projects to MSTest.Sdk and switch to Microsoft.NET.TestFramework.MSTest.
  • Replace xUnit [Fact]/[Theory]/[InlineData] with MSTest [TestMethod]/[DataRow] and add MSTest class annotations.
  • Update assertions and OS-gating to MSTest equivalents (e.g., OSCondition(OperatingSystems.Windows)).
Show a summary per file
File Description
test/msbuild.Integration.Tests/msbuild.Integration.Tests.csproj Switch project to MSTest.Sdk and update test framework reference/usings.
test/msbuild.Integration.Tests/GivenDotnetInvokesMSBuild.cs Convert xUnit tests to MSTest ([TestClass], [TestMethod], [DataRow]).
test/Microsoft.Win32.Msi.Tests/Microsoft.Win32.Msi.Tests.csproj Switch project to MSTest.Sdk and update test framework reference/usings.
test/Microsoft.Win32.Msi.Tests/WindowsInstallerTests.cs Convert theory-style tests to MSTest data-driven tests + OSCondition.
test/Microsoft.Win32.Msi.Tests/WindowsInstallerExceptionTests.cs Convert theory-style tests to MSTest data-driven tests + OSCondition.
test/Microsoft.Win32.Msi.Tests/EventArgsTests.cs Convert [WindowsOnlyFact] tests to MSTest + OSCondition and update assertions.
test/Microsoft.Win32.Msi.Manual.Tests/Microsoft.Win32.Msi.Manual.Tests.csproj Remove now-unneeded “global usings removal” block.
test/Microsoft.WebTools.AspireService.Tests/Microsoft.WebTools.AspireService.Tests.csproj Switch from Microsoft.NET.Sdk.Web to MSTest.Sdk, add Microsoft.AspNetCore.App framework reference, update test framework reference/usings.
test/Microsoft.WebTools.AspireService.Tests/RunSessionRequestTests.cs Convert [Fact] to [TestMethod] and switch away from xUnit helper usage.
test/Microsoft.WebTools.AspireService.Tests/AspireServerServiceTests.cs Convert xUnit tests to MSTest and adapt logging/cancellation to TestContext.

Copilot's findings

  • Files reviewed: 10/10 changed files
  • Comments generated: 1

Evangelink and others added 2 commits June 19, 2026 16:48
MTP (MSTest.Sdk) test apps were always invoked via 'dotnet exec <target>'.
For .NET Framework targets TargetPath is the native '.exe', which has no
runtimeconfig.json, so 'dotnet exec' treats it as a self-contained .NET Core
app and fails with 'hostpolicy.dll ... not found' (exit -2147450749). Launch
the .exe directly for .NETFramework while keeping 'dotnet exec <dll>' for
.NET (Core).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ServiceTests

Pass the test's CancellationToken into WaitForListeningAsync instead of
relying on the experimental TestContext.Current, removing the file-wide
#pragma warning disable MSTESTEXP.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g issue I have seen on a few PRs but not sure how to correctly create the related known build error (cc @MichaelSimons):

Expected:

type=build_complete, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj;/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=building, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj;/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=hot_reload_applied, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj;/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=process_started, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj],
type=process_started, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj],
type=process_started, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=restarting, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj]

Actual:

type=build_complete, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj;/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=building, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj;/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=hot_reload_applied, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj;/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=process_started, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj],
type=process_started, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceB/B.csproj],
type=restarting, projects=[/datadisks/disk1/work/AA40090B/t/dotnetSdkTests.CdbbpHIi/ServerAndReso---F77C2CBE/ServiceA/A.csproj]

@Evangelink Evangelink merged commit dfd70c8 into dotnet:main Jun 22, 2026
27 of 29 checks passed
@Evangelink Evangelink deleted the evangelink/mstest-msi-misc branch June 22, 2026 16:44
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants