Skip to content

Reference the fsi settings assembly when loading a script - #335

Merged
nojaf merged 2 commits into
ionide:mainfrom
nojaf:fsi-interactive-settings
Sep 12, 2026
Merged

nojaf merged 2 commits into
ionide:mainfrom
nojaf:fsi-interactive-settings

Conversation

@nojaf

@nojaf nojaf commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

A script may use the fsi object (fsi.CommandLineArgs, fsi.EventLoop, ...)
without saying anything, because dotnet fsi references
FSharp.Compiler.Interactive.Settings.dll implicitly. FCS looks for that
assembly next to its own binaries, which for a dotnet tool are the tool's
own files, so the reference silently dropped and every use of fsi failed
to type check. Error recovery then took the surrounding expressions with
it, leaving analyzers nothing to match on.

Pass -r: for the copy that ships in the FSharp folder of the SDK that
toolsPath points into, so scripts resolve fsi against the same SDK that
MSBuild loads projects with.

Fixes #334

A script may use the `fsi` object (fsi.CommandLineArgs, fsi.EventLoop, ...)
without saying anything, because `dotnet fsi` references
FSharp.Compiler.Interactive.Settings.dll implicitly. FCS looks for that
assembly next to its own binaries, which for a dotnet tool are the tool's
own files, so the reference silently dropped and every use of `fsi` failed
to type check. Error recovery then took the surrounding expressions with
it, leaving analyzers nothing to match on.

Pass `-r:` for the copy that ships in the FSharp folder of the SDK that
toolsPath points into, so scripts resolve `fsi` against the same SDK that
MSBuild loads projects with.

Fixes ionide#334
@nojaf
nojaf merged commit 150f4b5 into ionide:main Sep 12, 2026
2 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.

Scripts using fsi do not type check: FSharp.Compiler.Interactive.Settings is never referenced

1 participant