[Repo Assist] Fix: respect (IsTestProject)false(/IsTestProject) MSBuild property to exclude projects from Test Explorer#2139
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
Replace the manual package-reference check (looking for Microsoft.TestPlatform.TestHost / Microsoft.NET.Test.Sdk) with project.Info.IsTestProject, which is the authoritative MSBuild value already computed by FsAutoComplete. Fixes #1970: users who set <IsTestProject>false</IsTestProject> in their project file to prevent a paket-shared project from appearing in Test Explorer were ignored because the old check only looked at package references. The MSBuild property IsTestProject is set to true by the Microsoft.NET.Test.Sdk targets whenever test SDK packages are present, so the new check is semantically equivalent for standard projects while also respecting explicit user overrides. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 1, 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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Closes #1970
Users who have projects that reference test SDK packages (via shared paket dependencies or otherwise) but explicitly set
(IsTestProject)false(/IsTestProject)in their project file still see those projects in the Test Explorer and receive "no tests discovered" warnings. This PR fixes that.Root Cause
ProjectExt.isTestProjectinTestExplorer.fsdetermines whether a project should appear in the Test Explorer by checking if its package references includeMicrosoft.TestPlatform.TestHostorMicrosoft.NET.Test.Sdk. This check ignores theIsTestProjectMSBuild property, which is the authoritative way in .NET to declare whether a project is a test project.The
ProjectDTO already exposesIsTestProject: boolviaproject.Info.IsTestProject(populated from FsAutoComplete'sProjectResponseInfoDotnetSdk). This property correctly reflects MSBuild's computed value: it is set totrueby theMicrosoft.NET.Test.Sdkpackage targets when the SDK is present, and overridden tofalsewhen the user adds(IsTestProject)false(/IsTestProject)to their project file.Fix
Replace the manual package-reference scan with a direct check of
project.Info.IsTestProject:This is semantically equivalent for standard projects (the
Microsoft.NET.Test.Sdkpackage setsIsTestProject=truein its.targetsfile), while correctly respecting explicit user overrides.Trade-offs
Microsoft.NET.Test.Sdk, which setsIsTestProject=true.Microsoft.NET.Test.Sdktransitively (or directly), soIsTestProject=true. If an Expecto project does not use Test SDK,IsTestProjectmay befalseand would no longer appear in Test Explorer. This is actually correct — without Test SDK,dotnet test --list-testswouldn't work on it anyway.(IsTestProject)false(/IsTestProject): Now correctly excluded from Test Explorer. This is the fix for MSBuild<IsTestProject>is ignored #1970.Test Status
dotnet paket restoreandyarn installare unavailable in this environment due to network restrictions, so a full build cannot be run.The change is a one-line simplification from a multi-line array scan to a single property access. The
IsTestProjectfield is of typebooland is already used elsewhere inTestExplorer.fs(e.g.,project.Info.TargetFramework). The change is syntactically and type-correct.