Skip to content

F# Interactive does not auto-load script inside NuGet package. #18176

Closed
@teo-tsirpanis

Description

@teo-tsirpanis

I noticed after reading the source code, that when referencing a NuGet package F# Interactive automatically loads file content/MyPackage.fsx of the package if it exists. However it didn't work when I tried it.

Repro steps

  1. dotnet pack the following project:

FSharpInteractiveRepro.fsproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Content Include="FSharpInteractiveRepro.fsx" Pack="true" PackagePath="content" />
  </ItemGroup>
</Project>

FSharpInteractiveRepro.fsx

module FSharpInteractiveRepro

let num = 579
  1. Run the following commands:
dotnet fsi
> #i "<path-to-nupkg>";;
> #r "nuget: FSharpInteractiveRepro";;
> FSharpInteractiveRepro.num;;

Expected behavior

> #r "nuget: fsharpinteractiverepro";;
[Loading C:\Users\teo\.packagemanagement\nuget\Projects\24532--6e3f902d-4865-44ce-abd1-cebf1ab7db93\Project.fsproj.fsx
 Loading C:\Users\teo\.nuget\packages\fsharpinteractiverepro\1.0.0\content\FSharpInteractiveRepro.fsx]
module FSI_0003.Project.fsproj

module FSI_0003.FSharpInteractiveRepro
val num: int

> FSharpInteractiveRepro.num;;
val it: int = 579

Actual behavior

> #r "nuget: fsharpinteractiverepro";;
[Loading C:\Users\teo\.packagemanagement\nuget\Projects\3356--4b38b24b-1499-4dd4-8293-265011f7b2cf\Project.fsproj.fsx]
module FSI_0003.Project.fsproj

> FSharpInteractiveRepro.num;;

  FSharpInteractiveRepro.num;;
  ^^^^^^^^^^^^^^^^^^^^^^

stdin(3,1): error FS0039: The value, namespace, type or module 'FSharpInteractiveRepro' is not defined. Maybe you want one of the following:
   FSharpInterfaceDataVersionAttribute
   FSharp

Known workarounds

None known.

Related information

I am using .NET 9 SDK, but I think it reproduces in earlier versions since that code has not changed very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions