Migrate Microsoft.NET.Sdk.Publish.Tasks.Tests to MSTest.Sdk on MTP - #54854
Merged
Evangelink merged 9 commits intoJun 23, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the SDK acceptance-test xUnit→MSTest migration by converting Microsoft.NET.Sdk.Publish.Tasks.Tests to run on MSTest.Sdk (on Microsoft.Testing.Platform) and switching the project to use the MSTest-flavored test framework (Microsoft.NET.TestFramework.MSTest). It also adds MSTest equivalents of several custom conditional test attributes and an MSTest base class for ASP.NET SDK tests.
Changes:
- Switch
Microsoft.NET.Sdk.Publish.Tasks.TeststoMSTest.Sdkand update its framework reference toMicrosoft.NET.TestFramework.MSTest. - Convert Publish tasks tests from xUnit attributes/assertions to MSTest (
[TestClass],[TestMethod],[DataRow],[DynamicData], MSTest asserts). - Add MSTest implementations of conditional test attributes and
AspNetSdkTestinMicrosoft.NET.TestFramework.MSTest.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.NET.TestFramework.MSTest/ConditionalTestAttributes.cs | Adds MSTest equivalents for custom conditional attributes used across SDK tests. |
| test/Microsoft.NET.TestFramework.MSTest/AspNetSdkTest.cs | Introduces MSTest AspNetSdkTest base class mirroring the xUnit version. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj | Migrates the test project to MSTest.Sdk and switches test framework reference. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebJobsCommandGeneratorTests.cs | Converts xUnit theory to MSTest data-driven test. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTransformTests.cs | Converts xUnit facts/theories to MSTest methods with DataRow/DynamicData and MSTest asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/WebConfigTelemetryTests.cs | Converts xUnit theory to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/ZipDeploy/ZipDeploymentStatusTests.cs | Converts xUnit theories to MSTest DataRow tests and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/ZipDeploy/ZipDeployerTaskTests.cs | Converts xUnit fact/theories to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/TransformXmlTests.cs | Converts xUnit facts to MSTest and uses MSTest collection asserts (HasCount/IsEmpty). |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/TransformWebConfigTests.cs | Converts xUnit theory/fact to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/TransformAppSettingsTests.cs | Converts xUnit theories to MSTest DynamicData and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/OneDeploy/OneDeployTests.WebJob.cs | Converts xUnit theories to MSTest DataRow tests and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/OneDeploy/OneDeployTests.cs | Converts xUnit facts/theories to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/OneDeploy/OneDeployStatusServiceTests.cs | Converts xUnit facts/theories to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/OneDeploy/CreatePackageFileTests.cs | Converts xUnit facts/theories to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/GenerateEnvTransformTests.cs | Converts xUnit theories/facts to MSTest and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Tasks/GenerateEFSQLScriptsTests.cs | Converts xUnit member-data theory to MSTest DynamicData (NET472-only). |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/EnvironmentHelperTests.cs | Converts xUnit theory to MSTest DataRow test and updates asserts. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/EndToEnd/ProcessWrapper.cs | Replaces xUnit output helper usage with MSTest TestContext logging. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/EndToEnd/FolderPublish50.cs | Converts xUnit tests to MSTest and updates logging to use TestContext. |
| test/Microsoft.NET.Sdk.Publish.Tasks.Tests/AppSettingsTransformTests.cs | Converts xUnit facts/theories to MSTest DataRow/DynamicData and updates asserts. |
Copilot's findings
- Files reviewed: 21/21 changed files
- Comments generated: 4
…undation' into evangelink/mstest-mtp-publishtasks-tests
Evangelink
enabled auto-merge
June 19, 2026 11:14
Under MSTest method-level parallelism the data-driven test mutates the process-wide DOTNET_CLI_TELEMETRY_OPTOUT variable concurrently, producing nondeterministic Assert.AreEqual failures. Mark the class [DoNotParallelize]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
Member
Author
|
/ba-g blazor test crashing, it's unrelated to this PR |
Member
Author
|
/ba-g #54823 |
JeremyKuhne
approved these changes
Jun 22, 2026
JeremyKuhne
approved these changes
Jun 22, 2026
… build Microsoft.DotNet.Cli.Utils.Tests is an MSTest.Sdk project, but TransientSdkResolutionErrorDetectorTests.cs was added still using xUnit [Fact], so the test build fails with CS0246 'Fact'/'FactAttribute' on main and on every PR built against it (including this one). Add [TestClass] and convert the five [Fact] methods to [TestMethod]; MSTest.Sdk provides the MSTest namespace and FluentAssertions as implicit global usings, so no using changes are needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/ba-g #54927 |
YuliiaKovalova
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
Microsoft.NET.Sdk.Publish.Tasks.Testsfrom xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), switching its test-framework reference toMicrosoft.NET.TestFramework.MSTest.Part of the SDK acceptance-test xUnit-->MSTest migration. Depends on #54845 (the
Microsoft.NET.TestFramework.MSTestfoundation) which must merge first. Compiles clean locally for all target frameworks.