Skip to content

fix(#r "paket:"): honour the rollForward of the tool manifest - #4500

Merged
fpellet merged 2 commits into
masterfrom
fix/fsi-manifest-roll-forward
Nov 22, 2026
Merged

fpellet merged 2 commits into
masterfrom
fix/fsi-manifest-roll-forward

Conversation

@fpellet

@fpellet fpellet commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Follows #4499, on which it builds: findDotnet takes the paket.dll since #4496, and this change makes it see the roll forward of the manifest.

Problem

dotnet tool install --allow-roll-forward (SDK 8.0.300 and later) writes "rollForward": true for the tool in the manifest. dotnet tool run then runs it with dotnet --roll-forward Major <dll>, which the host takes over DOTNET_ROLL_FORWARD and the runtimeconfig.json: the tool runs on the major version it targets when the dotnet has it, and on a later one otherwise.

#r "paket:" runs the paket.dll of the local tool with a dotnet it picks itself (#4496), and ignored that setting. Paket 12 already rolls forward with the rollForwardOnNoCandidateFx: 2 of its runtimeconfig.json, so the difference shows when DOTNET_ROLL_FORWARD says otherwise: with Minor, LatestMinor or LatestPatch and no dotnet with .NET 10, or with Disable and none with .NET 10.0.0, #r "paket:" failed where dotnet paket worked; with LatestMajor, it ran Paket on the latest version of the dotnet where dotnet paket runs it on .NET 10.

Change

  • paketOfToolManifest gives the paket tool of the manifest, with its Version and its RollForward (ManifestPaket). "rollForward" is matched with its case, as the SDK reads it (TryGetBooleanValue, case-sensitive). The first "paket" object that has a version counts, so that a "paket" property of another tool doesn't hide the tool, as the single regex used before already ensured.
  • The local tool, found from the toolResolverCache or in the NuGet packages folders, runs with dotnet --roll-forward Major "<paket.dll>" (dotnetArguments), as the MuxerCommandSpecMaker of the SDK builds it.
  • The pick of the dotnet counts it: withRollForward lets runsApp take a later major version whatever DOTNET_ROLL_FORWARD says, and keeps DOTNET_ROLL_FORWARD, then the runtimeconfig.json, without it.
  • The most recent Paket .NET tool restored, which runs when the local tool isn't restored (fix(#r "paket:"): fall back when the local tool isn't restored #4498), runs without it: it is another version, and dotnet tool run would fail there.

Docs: a release note, and a few sentences in fsi-integration.md.

Commits:

  1. run the local tool with the rollForward of the manifest: ManifestPaket, dotnetArguments, the rollForward carried by PaketDll through choosePaket, their tests, the doc and the release note;
  2. count it when the dotnet is picked: withRollForward in findDotnet, its test, and the end of the first sentence of the release note.

Tests

tests/Paket.Tests/FsiExtension.fs:

  • paketOfToolManifest: the rollForward of paket in a manifest as dotnet tool install --allow-roll-forward writes it, false, "RollForward" with another case, the rollForward of another tool, and a "paket" property of another tool;
  • withRollForward: --roll-forward Major before DOTNET_ROLL_FORWARD, and without it DOTNET_ROLL_FORWARD, then the roll forward of the runtimeconfig.json;
  • dotnetArguments: --roll-forward Major before the paket.dll;
  • choosePaket: the rollForward of the local tool is passed on.

Checked by hand on Linux, with SDK 10.0.404 and runtime 10.0.15 only, dotnet fsi --compilertool: pointing at the built extension, and a manifest written by dotnet tool install paket --version 12.0.0-alpha003 --allow-roll-forward with its own DOTNET_CLI_HOME:

  • :paket> using /usr/share/dotnet/dotnet --roll-forward Major "…/paket.dll", and the script gets its package;
  • with the runtimeconfig.json of the restored paket.dll changed to ask for 9.0.0 without roll forward, and DOTNET_ROLL_FORWARD=Minor: with "rollForward": true the script runs, and with false it fails ("You must install or update .NET"), as dotnet paket does in both cases.

Limits

  • The most recent Paket .NET tool restored, which runs when the local tool isn't restored, doesn't get the rollForward of the manifest (above).
  • Manifests that dotnet rejects or reads otherwise are read leniently: "rollForward": "true" or null, with which dotnet tool run fails, count as false; a duplicate key, or a commented-out "rollForward": true, count as true.
  • With an SDK before 8.0.300, picked by a global.json, dotnet tool run doesn't read the rollForward of the manifest, while #r "paket:" does.
  • runsApp still counts LatestPatch and Disable as Minor (fix(#r "paket:"): find dotnet to run the local tool #4496): with DOTNET_ROLL_FORWARD=Disable and no rollForward in the manifest, the first dotnet with a .NET 10 is taken even when it lacks 10.0.0.
  • The zsh completion also runs the paket.dll of the local tool with dotnet, without the rollForward of the manifest.
  • The wiring in PaketHandler, which is internal, has no automated test.

…aket:"

`dotnet tool run` runs a local tool with --roll-forward Major when its
manifest says "rollForward": true, as `dotnet tool install
--allow-roll-forward` writes it. #r "paket:" ran the paket.dll as its
runtimeconfig.json and DOTNET_ROLL_FORWARD said, so it could fail where
`dotnet paket` worked: the Paket .NET tools roll forward with their
rollForwardOnNoCandidateFx, unless DOTNET_ROLL_FORWARD is Minor,
LatestMinor, LatestPatch or Disable. With LatestMajor, it ran on the
latest major version rather than on the one of the tool.

The manifest gives the paket tool, with its version and its
rollForward, matched with its case as dotnet reads it, from the first
"paket" object that has a version. The paket.dll of the local tool is
paired with that rollForward in one place. The most recent Paket .NET
tool restored, which runs when the local tool isn't restored, runs
without it: it is another version.
With --roll-forward Major, which the host takes over DOTNET_ROLL_FORWARD
and the runtimeconfig.json, the local tool also runs on a later major
version of .NET. The pick of dotnet didn't know it: with
DOTNET_ROLL_FORWARD=Minor, a dotnet with only a later major version was
taken as unable to run paket, and passed over. withRollForward takes
--roll-forward Major as a DOTNET_ROLL_FORWARD of Major, and findDotnet
moves into Internals.Logic, with DOTNET_ROLL_FORWARD as a parameter, so
that a test checks the dotnet it picks.
@fpellet
fpellet force-pushed the fix/fsi-manifest-roll-forward branch from 08f5688 to b843c73 Compare November 22, 2026 17:37
@fpellet
fpellet merged commit ec2542b into master Nov 22, 2026
5 checks passed
@fpellet
fpellet deleted the fix/fsi-manifest-roll-forward branch November 22, 2026 18:34
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.

1 participant