ionide / Fornax

Scriptable static site generator using type safe F# DSL to define page templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fornax.Core dll not reference-able using '#r "nuget:Fornax"

jbeeko opened this issue · comments

Describe the bug
#r "nuget:Fornax" will download the package to the .nuget cache but the dll can't be found. This means in the F# 5.0 world it will not be possible to write loaders, etc with just nuget refs.

To Reproduce
Open the below as a .fsx file in Ionide on a system with .NET 5.0 installed. Note SiteContents is not not visible to compiler. Uncomment the direct reference and it becomes visible. I believe this is because the Fornax.Core.dll is in a non-standard location.

#r "nuget: Fornax"
//#r "/Users/joergbeekmann/.nuget/packages/fornax/0.13.1/tools/netcoreapp3.1/any/Fornax.Core.dll"

let x: SiteContents option = None

Expected behaviour
SiteContents should be resolved like it is if the direct reference is in place.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: MacOS
  • Ionide version: 4.11.1
  • VSCode version: latest
  • dotnet SDK version: 5.0
  • mono / .Net Framework version: N/A

I think the issue is we don't use --langversion:preview in FSI session hosted in Fornax - https://github.com/ionide/Fornax/blob/master/src/Fornax/Generator.fs#L31

@Krzysztof-Cieslak I don't think that is the issue because on my system with with F# 5.0 the compiler service can't resolve those references. But I'll find out if they can be referenced in a standard project in which case the bug is on the FSharp compiler side.

Oh, it may be caused by the fact Fornax is packed as a tool and referencing tool is probably not supported scenario. In such a case, we will need to release Fornax.Core as normal NuGet package.

CC: @cartermp could you confirm this suspicion?

Yeah, you can't reference a global tool like a normal nuget package:
image

So you'd need to release some kind of core library for folks to use if they want to do it that way.

Is it be possible to release Fornax.Core as a NuGet package?

In my project I am using paket to manage the dependencies thanks to its generate_load_scripts features. And Fornax.Core is the only dll I cannot manage this way.

Note: I am using paket instead of #r "nuget: ..." because #r is really slow to resolve. For me it adds 4 sec per fsx file where it is present. Because paket install the dlls locally it doesn't "really" had a overhead each time the file is being process.