Skip to content

Leave the load scripts to the restore after paket update --no-install - #4486

Merged
fpellet merged 2 commits into
masterfrom
fix/restore-script
Nov 8, 2026
Merged

fpellet merged 2 commits into
masterfrom
fix/restore-script

Conversation

@fpellet

@fpellet fpellet commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #2785

With generate_load_scripts: true, paket update --no-install failed with Folder .../packages/<package> doesn't exist. Did you restore group Main? when a package of the new paket.lock wasn't restored, as on a fresh checkout or for a package that the update adds. This branch leaves the load scripts to the next restore.

Cause

SmartInstall (UpdateProcess.fs) only downloads the packages in InstallProcess.InstallIntoProjects, which --no-install skips, but it generated the load scripts afterwards anyway. DependencyCache reads them from the packages folder and fails on the first package that isn't there. When all the folders were there, the scripts were written from the packages of the old lock file.

Fix

  • Load scripts: with --no-install, update writes paket.lock and skips the load scripts. It doesn't write paket-files/paket.restore.cached either, as only InstallIntoProjects does, so the next paket restore finds a lock file that doesn't match the cache: it downloads the packages and generates the scripts, as after any other change of the lock file.
  • Hint: when the lock file changes, update prints that the next paket restore will generate the load scripts.
  • update --no-install doesn't download the packages to generate the scripts itself, and keeps writing only the lock file.

Tests

  • LoadingScriptGenerationTests: on the issue-2939 scenario (generate_load_scripts: true, nothing restored), update --no-install writes paket.lock and prints the hint, without downloading the packages or creating .paket/load. The restore that follows generates Newtonsoft.Json.fsx. Without the fix, the test fails with the error of the issue.
  • With the built paket, a second update --no-install that leaves the lock file unchanged prints no hint.

…stall

With generate_load_scripts: true, paket update --no-install generated the
load scripts from the packages folder, which --no-install doesn't download.
It failed with "Folder ... doesn't exist. Did you restore group Main?" when
a package of the new paket.lock wasn't there, as on a fresh checkout or for
a package that the update adds, and wrote the scripts from the packages of
the old lock when versions changed. As --no-install doesn't write the
restore cache, the next restore sees the new lock, downloads the packages
and generates the scripts.

Fixes #2785
…he load scripts

The hint is printed when update --no-install changes paket.lock, the case
where the next restore downloads the packages and generates the scripts.
It names paket restore rather than the --no-install flag, which API callers
don't pass.
@fpellet
fpellet merged commit 3e17fee into master Nov 8, 2026
19 checks passed
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.

Paket crash when --no-install is specified on update with generate_include_scripts

1 participant