Skip to content

Set MSTest.Sdk-wide defaults: UseMSTestSdk, method-level parallelization, Recommended analyzers#54766

Open
Evangelink wants to merge 2 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-sdk-globals
Open

Set MSTest.Sdk-wide defaults: UseMSTestSdk, method-level parallelization, Recommended analyzers#54766
Evangelink wants to merge 2 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-sdk-globals

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Continuation of the MSTest.Sdk migration. Sets three repo-wide MSTest.Sdk defaults that were missing after the initial conversion (e.g. #54731, ce24be8, 8c5d462).

Changes

Directory.Build.propsUseMSTestSdk=true (global)

Arcade's Microsoft.DotNet.Arcade.Sdk/tools/MSTest/MSTest.targets reads UseMSTestSdk and, when true:

  • Skips its implicit Microsoft.TestPlatform / MSTest.TestFramework / MSTest.TestAdapter PackageReferences.
  • Removes the implicitly-added Microsoft.NET.Test.Sdk from test projects.

Net effect: MSTest package versions don't need to be declared in Directory.Packages.props — MSTest.Sdk owns those versions.

test/Directory.Build.props — MSTest.Sdk defaults (gated on UsingMSTestSdk==true)

  • <MSTestParallelizeScope>MethodLevel</MSTestParallelizeScope> — MSTest.TestAdapter's Parallelize.targets emits [assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] for every MSTest.Sdk project, so we don't have to author an MSTestSettings.cs per project.
  • <MSTestAnalysisMode>Recommended</MSTestAnalysisMode> — promotes info-level MSTest analyzer rules to warnings (and critical rules to errors).

Both are gated on the built-in UsingMSTestSdk (the convention adopted in 8c5d462 / 941324f) so xUnit test projects are not affected.

Validation

XML validates. The repo's .dotnet is not bootstrapped in my local workspace so I did not run a full build — CI will be the truth here.

…ion, Recommended analyzers

- Set UseMSTestSdk=true globally in Directory.Build.props so Arcade does not
  implicitly add Microsoft.TestPlatform / MSTest.TestFramework /
  MSTest.TestAdapter / Microsoft.NET.Test.Sdk PackageReferences (MSTest.Sdk
  brings them transitively with versions controlled by the SDK).
- Default MSTestParallelizeScope=MethodLevel for MSTest.Sdk test projects so
  MSTest.TestAdapter emits [assembly: Parallelize(Scope = MethodLevel)].
- Default MSTestAnalysisMode=Recommended for MSTest.Sdk test projects.

The two MSTest defaults are gated on UsingMSTestSdk=true (the built-in
MSTest.Sdk property) so they only apply to MSTest.Sdk projects, not xUnit ones.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 15, 2026 07:44
@Evangelink Evangelink enabled auto-merge (squash) June 15, 2026 07:46

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 continues the repo’s MSTest.Sdk migration by setting repo-wide MSBuild defaults to better align test project configuration with MSTest.Sdk expectations and reduce per-project boilerplate.

Changes:

  • Enable UseMSTestSdk=true at the repo level so Arcade doesn’t implicitly add/override MSTest/VSTest package references for MSTest.Sdk projects.
  • Add MSTest.Sdk-only defaults under test/ for method-level parallelization and Recommended MSTest analyzer mode.
Show a summary per file
File Description
Directory.Build.props Sets UseMSTestSdk=true so Arcade defers MSTest dependency/versioning to MSTest.Sdk.
test/Directory.Build.props Adds MSTest.Sdk-gated defaults for parallelization scope and analyzer severity mode.

Copilot's findings

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

Comment thread test/Directory.Build.props
…sMode=Recommended

Use Assert.IsGreaterThan / IsGreaterThanOrEqualTo / IsLessThan / AreEqual /
AreNotEqual / HasCount instead of Assert.IsTrue(x > y) / Assert.AreEqual(.Count).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants