I am using .net core preview 5 with dotnet fsi I have the following code using FSharp.Literate
#I "./packages"
#r @"FSharp.Literate/lib/netstandard2.0/FSharp.Markdown.dll"
#r @"FSharp.Literate/lib/netstandard2.0/FSharp.CodeFormat.dll"
#r @"FSharp.Literate/lib/netstandard2.0/FSharp.Literate.dll"
#r @"NetStandard.Library/build/netstandard2.0/ref/netstandard.dll"
open FSharp.Literate
Literate.ParseScriptString(null)
//Literate.ProcessScriptFile(null)
The first line causes :
error FS0193: Could not load file or assembly 'FSharp.Compiler.Service, Version=27.0.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
If you comment that line and uncomment second one you get:
error FS3216: type 'FSharp.CodeFormat.CodeFormatAgent' not found in assembly 'FSharp.CodeFormat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version.
cc @KevinRansom
It feels like this is by design, you need to reference all dependencies as well? Or do I miss something obvious?
You shouldn't need to do that, no. Especially not netstandard.dll. But given that it's still in preview there could be something wrong going on.
@OnurGumus I presume you used nuget or paket to pre-fetch all of the required dependencies. Could you please specify the complete steps to repro this:
For sure you will need to specify a:
The netstandard.dll reference seems very wrong. although I doubt if it would do any harm, since it is already referenced.
Thanks
Kevin
@KevinRansom I know, using netstandard.dll is very wrong, I added these while trying to diagnose. But they don't change the result. Here are the full steps for reproduction:
In an empty directory,
dotnet tool install --tool-path .paket Paket
.paket\paket init
.paket\paket add FSharp.Literate
Then create a test.fsx file by using an editor put the above content. You can remove things like netstandard as it doesn't fix anything. After that run:
dotnet fsi test.fsx
The output is :
error FS0193: Could not load file or assembly 'FSharp.Compiler.Service, Version=27.0.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
@OmarTawfik
Yes I believe that should work, and it doesn't. There is a minor issue with your repro. the #I should be
However, even correcting that it fails:
````
C:\temp\repro>dotnet fsi
Microsoft (R) F# Interactive version 10.4.0 for F# 4.6
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
I "../packages"
- #r @"FSharp.Literate/lib/netstandard2.0/FSharp.Markdown.dll"
- #r @"FSharp.Literate/lib/netstandard2.0/FSharp.CodeFormat.dll"
- #r @"FSharp.Compiler.Service/lib/netstandard2.0/FSharp.Compiler.Service.dll"
- #r @"FSharp.Literate/lib/netstandard2.0/FSharp.Literate.dll"
- open FSharp.Literate;;
--> Added 'C:\temp\repro../packages' to library include path
--> Referenced 'C:\temp\repro../packages\FSharp.Literate/lib/netstandard2.0/FSharp.Markdown.dll' (file may be locked by F# Interactive process)
--> Referenced 'C:\temp\repro../packages\FSharp.Literate/lib/netstandard2.0/FSharp.CodeFormat.dll' (file may be locked by F# Interactive process)
--> Referenced 'C:\temp\repro../packages\FSharp.Compiler.Service/lib/netstandard2.0/FSharp.Compiler.Service.dll' (file may be locked by F# Interactive process)
--> Referenced 'C:\temp\repro../packages\FSharp.Literate/lib/netstandard2.0/FSharp.Literate.dll' (file may be locked by F# Interactive process)
Literate.ParseScriptString(null);;
error FS0193: Could not load file or assembly 'FSharp.Compiler.Service, Version=27.0.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
>
````
I will take a look when I get a chance.
Kevin
@KevinRansom I think you've got the wrong tag 馃槃
@OmarTawfik, hey mate, I did indeed.
@OnurGumus do you still have an issue?
@KevinRansom Above steps still produce the same problem.
Commenting to track the issue, because I have a nearly identical error FS3216 with #r "Microsoft.ServiceFabric.Client.Http\lib\netstandard2.0\Microsoft.ServiceFabric.Client.dll"
With preview 9 the issue still persists as of today.
Tagging as a backlog item for .NET Core 3.1 - @KevinRansom this and the FSI-using-mono.posix issue should be slated for .NET Core 3.1
@OnurGumus You can work around the issue with this hack for now:
// HACK: force usage of Fsharp.Compiler.Services
// or the indirect reference from FSharp.Literate will fail to load
let dummy (pos: FSharp.Compiler.Range.pos) =
pos.Column
FSharp.Compiler.Range.mkPos 1 1 |> dummy
Found this in a Github Issue for Literate.
I didn't try the original case but my original goal was to use
FSharp.Compiler.Service
and Fsharp.Literate.
Now they work out of box with .net core .net 3.1.
I don't have any complaints any more. Should I close the issue ?
@OnurGumus Please feel free to close unless @KevinRansom has any objections
Most helpful comment
@OnurGumus You can work around the issue with this hack for now:
Found this in a Github Issue for Literate.