Skip to content

--noRestore flag does not skip MSBuildCracker restores #4527

@randrag

Description

@randrag

Description

The --noRestore CLI flag is parsed and stored in CrackerOptions.NoRestore, but MSBuildCrackerResolver.mkOptionsFromDesignTimeBuildAux hardcodes /restore in the dotnet msbuild arguments, so the flag has no effect on the MSBuildCracker code path.

This causes sequential per-project restores during the project cracking phase, adding ~20s to compilations for projects with many transitive references (~25 in our case), even when the user passes --noRestore.

Repro code

No F# repro needed — this is a CLI/infrastructure issue. Steps:

  1. Have a project with many transitive ProjectReferences
  2. dotnet restore the root project
  3. dotnet fable --noRestore
  4. Observe that Fable still runs dotnet msbuild ... /restore for each referenced project during the "Parsing" phase

The /restore is hardcoded at MSBuildCrackerResolver.fs line 146:

let arguments =
    $"/restore /t:%s{targets} %s{properties} --getItem:FscCommandLineArgs ..."

options.NoRestore is available on CrackerOptions but never checked.

Expected and actual results

Expected: With --noRestore, the MSBuild design-time build should omit /restore, skipping per-project restores.

Actual: /restore is always included regardless of the flag.

Related information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions