Skip to content

start-vs-VisualFSharpSln.ps1: build against the hive's own Roslyn - #20467

Open
xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:start-vs-hive-roslyn
Open

xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:start-vs-hive-roslyn

Conversation

@xperiandri

@xperiandri xperiandri commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Description

F5 loads the F# extension into a hive named by RootSuffix, and that hive's own deployed Roslyn wins over the installed VS's whenever one is present: a locally built Roslyn deployed into a hive stamps itself 42.42.42.42 and adds a hive-level binding redirect so every reference resolves to it. The script only ever looked at the installed VS's shipped Roslyn, so it built against the wrong version whenever the target hive carried its own — RoslynDev in particular, which DEVGUIDE.md already points contributors at for this exact script.

It now reads devenv.isolation.ini to find the hive's own Extensions folder first, and only falls back to the installed VS's shipped Roslyn when the hive has none of its own. A new -RootSuffix parameter names the hive (default RoslynDev, matching the VisualFSharpDebug launch profile). When the detected version's minor already matches what eng/Version.Details.props flows, no override file is written at all — the common case for a hive built from this repo's own source — and a locally built hive Roslyn with no package version now fails fast asking for -RoslynVersion instead of silently building against mismatched packages.

-RootSuffix also decides where the extension runs, not just which Roslyn it is built against. The hive F5 deploys into and the /rootsuffix that launchSettings.json passes both come from VSSDKTargetPlatformRegRootSuffix, which vsintegration/Vsix/Directory.Build.props derived from a hard-coded VSRootSuffix. That property now defaults to RoslynDev only when nothing set it, and the script passes its suffix to the Visual Studio it launches through the environment. Builds that do not go through the script are unchanged: with nothing set the VSIX projects still resolve RoslynDev.

The override file also moves to its own path (RoslynOverride.start-vs.props) so a build-vs-VisualFSharpSln.ps1 run in the same session can't silently overwrite it — a long-lived VS process restores against whatever CustomAfterMicrosoftCommonProps last pointed at.

Tooling only; no compiler or IDE code path changes, so no release notes entry.

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

✅ No release notes required

@github-actions github-actions Bot added ⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Restore Tooling check: PR touches NuGet packages or feeds labels Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Build-Infra, Affects-Restore
Affects-Build-Infra: script sets CustomAfterMicrosoftCommonProps and generates MSBuild override props
Affects-Restore: runs Restore.cmd with overridden Roslyn package versions

Generated by PR Tooling Safety Check · opus46 3.3M ·

@xperiandri xperiandri changed the title start-vs-VisualFSharpSln.ps1: build against the hive's own Roslyn start-vs-VisualFSharpSln.ps1: build against the hive's own Roslyn Sep 6, 2026
Comment thread start-vs-VisualFSharpSln.ps1
@xperiandri
xperiandri requested a review from T-Gro September 9, 2026 21:16
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Sep 10, 2026
xperiandri and others added 2 commits September 11, 2026 17:33
F5 loads the extension into a hive (RootSuffix), and that hive's own
deployed Roslyn wins over the installed VS's when one is present: a
locally built Roslyn deployed there stamps itself 42.42.42.42 and
redirects every reference to itself via a hive-level binding
redirect. The script detected the installed VS's Roslyn version and
overrode the repo's packages to match it unconditionally, which
built against the wrong version whenever the target hive carried its
own Roslyn - RoslynDev in particular, the hive this repo's own DEVGUIDE
points contributors at.

It now reads devenv.isolation.ini to find the hive's own Extensions
folder first, and only falls back to the installed VS's Roslyn when
the hive has none of its own. A new -RootSuffix parameter names the
hive (default RoslynDev, matching the VisualFSharpDebug launch
profile). When the detected version's minor matches what the repo's
Version.Details.props already flows, no override is written at all -
the common case for a hive built from this same source - and a
locally built hive Roslyn with no package version at all now fails
fast asking for one instead of silently building against packages
that do not match what will actually load.

The override file also moves to its own path
(RoslynOverride.start-vs.props) so a build-vs-VisualFSharpSln.ps1 run
in the same session cannot silently overwrite it, since a long-lived
VS process restores against whatever CustomAfterMicrosoftCommonProps
last pointed at.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
-RootSuffix only chose which hive to read the Roslyn version from:
the VSIX projects hard-coded VSRootSuffix to RoslynDev, and that is
both the hive F5 deploys into and the /rootsuffix launchSettings
passes, so -RootSuffix Foo built against Foo's Roslyn and then ran in
RoslynDev.

VSRootSuffix now defaults to RoslynDev only when nothing set it, and
the script hands its suffix to the Visual Studio it launches, whose
builds read it from the environment.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Restore Tooling check: PR touches NuGet packages or feeds AI-reviewed PR reviewed by AI review council

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants