Skip to content

Use the CLI for runnable-project classification once it exposes a query API #273

Closed

Description

Context

The run-target picker (WinApp: Run Application, Run Application (Advanced), and the F5 fallback) lists projects and solutions discovered across the workspace. To keep class libraries and test projects out of that list, src/project-detection.ts classifies each project file with a small static parse:

  • <IsTestProject>true</IsTestProject> → test
  • a Microsoft.NET.Test.Sdk PackageReference → test
  • explicit <OutputType>Library</OutputType> → library
  • anything else, including a missing OutputType → unknown, and therefore still offered

This is deliberately one-sided and fails open (filterOfferableProjects returns the unfiltered list if filtering would remove every candidate), and the extension defers the real decision to the CLI: --project is only passed when two or more candidates survive, otherwise nothing is passed and winapp run resolves it.

Why this is a placeholder

winapp run already classifies authoritatively via full MSBuild evaluation, but exposes no way to query that result without building and launching. Filed upstream as microsoft/winappCli#957.

A static parse cannot see an OutputType that comes from an SDK default, Directory.Build.props, or a condition. When it disagrees with the CLI, the extension can narrow to a single candidate, skip the disambiguation prompt, pass no --project, and the run then fails with the CLI's ambiguity error. That error is clear and now surfaces in the WinApp output channel behind Show Output, so it is recoverable — but a correct list would avoid it.

What to do when the upstream API lands

  1. Prefer the CLI's discovery output (for example winapp run <input> --list-projects --json) when the bundled CLI supports it.
  2. Fall back to the current static heuristic when it does not — the extension currently downloads latest, so it must tolerate both (see Pin the bundled winappcli version (or detect version skew) instead of always downloading latest #250).
  3. Use the CLI's reported auto-selection to decide whether to prompt at all, replacing the local "prompt only when ≥2 candidates" rule.
  4. Drop or reduce classifyProjectRunnability / readProjectRunnability / isOfferableProject once the fallback is no longer needed.

Not worth doing

Parsing the candidate list out of winapp run's ambiguity message on stderr. It is an emoji-decorated, potentially localized console string, and it costs a failed run on every ambiguous launch.

Pointers

  • src/project-detection.ts — classifyProjectRunnability, readProjectRunnability, isOfferableProject
  • src/run-target.ts — filterOfferableProjects, filterOfferableCandidates
  • src/run-utils.ts — pickRunTarget, pickSolutionProject
  • src/test/project-runnability.test.ts — classification tests, including the fail-open rule

Activity

  1. chiaramooney commented on Oct 16, 2026

    @chiaramooney
    ContributorAuthor

    Tracked in winappcli repo. Closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions