Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
teo-tsirpanis opened this issue Dec 25, 2024 · 0 comments · May be fixed by #18177
Open

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

teo-tsirpanis opened this issue Dec 25, 2024 · 0 comments · May be fixed by #18177

Comments

@teo-tsirpanis
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

Successfully merging a pull request may close this issue.

1 participant