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

Cannot #r "paket: ..." from FSI because 'net50' should be 'net5.0' #4092

Closed
tnishimura opened this issue Oct 20, 2021 · 4 comments
Closed

Cannot #r "paket: ..." from FSI because 'net50' should be 'net5.0' #4092

tnishimura opened this issue Oct 20, 2021 · 4 comments

Comments

@tnishimura
Copy link

tnishimura commented Oct 20, 2021

Description

When I try to load a package using paket in FSI, I get the error message below.

The problem seems to be that the unfound file should be /tmp/script-packages/1663083604/.paket/load/net5.0/main.group.fsx with a net5.0 instead of net50. The particular package (Suave in the above example) does not seem to matter, errors are the same every time.

$ dotnet fsi --compilertool:"/home/user/.nuget/packages/fsharp.dependencymanager.paket/6.2.1/lib/netstandard2.0"

Microsoft (R) F# Interactive version 11.4.2.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #r "paket: nuget Suave";;
:paket> using /home/user/.dotnet/tools/paket
:paket> Paket version 6.2.1+c82f25d6c324024cbd231df154a447a117c2546e
:paket> Skipping resolver for group Main since it is already up-to-date
:paket> Installing into projects:
:paket> Created dependency graph (2 packages in total)
:paket> Total time taken: 9 milliseconds

  #r "paket: nuget Suave";;
  ^^^^^^^^^^^^^^^^^^^^^^^

/home/user/stdin(1,1): error FS0078: Unable to find the file '/tmp/script-packages/1663083604/.paket/load/net50/main.group.fsx' in any of
 /tmp/script-packages/1663083604/paket-files
 /home/user

Repro steps

  1. Install 'dotnet-sdk-5.0' installed via the official MS apt repo on Ubuntu 20.04 (version info below)

    $ dotnet info

    .NET SDK (reflecting any global.json):
    Version: 5.0.400
    Commit: d61950f9bf

    Runtime Environment:
    OS Name: pop
    OS Version: 20.04
    OS Platform: Linux
    RID: linux-x64
    Base Path: /usr/share/dotnet/sdk/5.0.400/

    Host (useful for support):
    Version: 5.0.11
    Commit: f431858f8b

    .NET SDKs installed:
    3.1.414 [/usr/share/dotnet/sdk]
    5.0.400 [/usr/share/dotnet/sdk]

    .NET runtimes installed:
    Microsoft.AspNetCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
    Microsoft.NETCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

    To install additional .NET runtimes or SDKs:
    https://aka.ms/dotnet-download

  2. Installed paket via dotnet tool install -g paket (version info below)

    $ paket info

    Paket version 6.2.1+c82f25d6c324024cbd231df154a447a117c2546e
    Total time taken: 0 milliseconds

  3. Create a dummy project to install (and cache) FSharp.DependencyManager.Paket in ~/.nuget, so that it can be passed to FSI via --compilertool as described here. I am not sure if this is actually what I'm supposed to do.)

    dotnet new console -lang 'F#' -o dummy
    cd dummy
    dotnet add package FSharp.DependencyManager.Paket --version 6.2.1

Expected behavior

#r "paket: nuget PackageName" should work. (In fact, it did work with earlier version I can't remember, around 6.0.something.

Actual behavior

See Description.

Known workarounds

None that I know.

@smoothdeveloper
Copy link
Contributor

Just a heads up that I've faced net50 vs net5.0 issues in other context than the FSI extension, and I'm not sure if it is contextual to nuget packages, framework SDK, or just a plain thing which got changed in paket in how the net5 moniker get's "canonicalised".

In paket code there are lots of things to handle framework moniker, it eventually gets used to generate the load scripts the #r "paket: ..." feature relies on, and ends up putting the name which doesn't work in some environments / versions of paket / nuget packages.

Maybe as work around, you can go to the temporary folder and rename the folder, and execute again in your FSI session.

I am not sure if this is actually what I'm supposed to do.

There is no official deployment guidelines for compilertool extensions, you may interact on this issue with suggestions: dotnet/fsharp#8880

@haraldsteinlechner
Copy link
Contributor

i also run into this problem. does this effectively mean paket interactive integration is unusable currently or is there a different persistent workaround or another trick?
One could also try to integrate a fallback, when the fsx is not found try another path using net50?

@haraldsteinlechner
Copy link
Contributor

might it be the cases this is somehow related: fsprojects/FAKE#2564

@haraldsteinlechner
Copy link
Contributor

haraldsteinlechner commented Dec 21, 2021

@tnishimura i tried to fix the problem but it was not here (anymore?). i tested in dotnet 6.0.100 and dotnet 6.0.101 and F# 6.0 on windows and it worked. Here is a repro repository: https://github.com/haraldsteinlechner/paket-fsi-test

could you check on your machine as well?

EDIT: i just pushed a commit which fixes the dotnet version using global.json. now i can exactly reproduce the error and confirm it goes away in .net 6.

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

No branches or pull requests

3 participants