Repository navigation
Closed
Labels
Description
I am not able to get FSharp.Formatting running on .NET core 2.0. I know that F# scripts (.fsx) are not supported on .NET core, so I created a small console project to call FSharp.Formatting.
I use the following code in Program.fs
open FSharp.MetadataFormat
open System.IO
[<EntryPoint>]
let main argv =
MetadataFormat.Generate ("../mylib/bin/Debug/netstandard2.0/mylib.dll",
"../docs", ["../templates"])
0 where mylib.dll is a .NET standard 2.0 DLL that was built successfully.
I get the following output when running this program:
Unhandled Exception: System.Exception: Could not find a FSharp.Core.dll (with bundled .optdata and .sigdata) in
[ "/home/surban/dev/fsformat/mylib/bin/Debug/netstandard2.0/mylib.dll"
"/home/surban/dev/fsformat/gendoc/bin/Debug/netcoreapp2.0/FSharp.Core.dll"
"/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.4/FSharp.Core.dll"
"/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.4/FSharp.Core.dll"
"/home/surban/dev/fsformat/gendoc/FSharp.Core.dll"
"/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.4/FSharp.Core.dll"
"/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.4/FSharp.Core.dll"
"/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.4/FSharp.Core.dll"
"/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.4/FSharp.Core.dll"
"/home/surban/.nuget/packages/fsharp.formatting/2.14.4/lib/net40/FSharp.Core.dll"
"/home/surban/.nuget/packages/fsharp.compiler.service/2.0.0.6/lib/net45/FSharp.Core.dll" ]
at Yaaf.FSharp.Scripting.CompilerServiceExtensions.FSharpAssemblyHelper.findFSCore@146-1.Invoke(String message)
at Yaaf.FSharp.Scripting.CompilerServiceExtensions.FSharpAssemblyHelper.getProjectReferences(String frameworkVersion, FSharpOption`1 otherFlags, FSharpOption`1 libDirs, IEnumerable`1 dllFiles)
at Yaaf.FSharp.Scripting.CompilerServiceExtensions.FSharpAssembly.LoadFiles.Static(IEnumerable`1 dllFiles, FSharpOption`1 libDirs, FSharpOption`1 otherFlags, FSharpOption`1 manualResolve)
at FSharp.MetadataFormat.MetadataFormat.Generate(IEnumerable`1 dllFiles, String outDir, FSharpList`1 layoutRoots, FSharpOption`1 parameters, FSharpOption`1 namespaceTemplate, FSharpOption`1 moduleTemplate, FSharpOption`1 typeTemplate, FSharpOption`1 xmlFile, FSharpOption`1 sourceRepo, FSharpOption`1 sourceFolder, FSharpOption`1 publicOnly, FSharpOption`1 libDirs, FSharpOption`1 otherFlags, FSharpOption`1 markDownComments, FSharpOption`1 urlRangeHighlight, FSharpOption`1 assemblyReferences)
at FSharp.MetadataFormat.MetadataFormat.Generate(FSharpList`1 dllFiles, String outDir, FSharpList`1 layoutRoots, FSharpOption`1 parameters, FSharpOption`1 namespaceTemplate, FSharpOption`1 moduleTemplate, FSharpOption`1 typeTemplate, FSharpOption`1 xmlFile, FSharpOption`1 sourceRepo, FSharpOption`1 sourceFolder, FSharpOption`1 publicOnly, FSharpOption`1 libDirs, FSharpOption`1 otherFlags, FSharpOption`1 markDownComments, FSharpOption`1 urlRangeHighlight, FSharpOption`1 assemblyReferences)
at FSharp.MetadataFormat.MetadataFormat.Generate(String dllFile, String outDir, FSharpList`1 layoutRoots, FSharpOption`1 parameters, FSharpOption`1 namespaceTemplate, FSharpOption`1 moduleTemplate, FSharpOption`1 typeTemplate, FSharpOption`1 xmlFile, FSharpOption`1 sourceRepo, FSharpOption`1 sourceFolder, FSharpOption`1 publicOnly, FSharpOption`1 libDirs, FSharpOption`1 otherFlags, FSharpOption`1 markDownComments, FSharpOption`1 urlRangeHighlight, FSharpOption`1 assemblyReferences)
at Program.main(String[] argv) in /home/surban/dev/fsformat/gendoc/Program.fs:line 6
I also tried running FSharp.Formatting on NET full (i.e. mono), but when using it to generate documentaion for .NET standard DLLs it complains about missing references to assembly "netstandard".
Activity
thinkbeforecoding commentedon Oct 10, 2018
We were discussing the topic at openfsharp with @tpetricek and thought it could be good to release FSharp.Literate as a separate nuget for netstandard2.0, and ditch Razor support for netcore.
For my blog engine, I made a netstandard2.0 version of FSharp.Literate which is not very difficult to support, and use fable-react + fulma for templating. All this running on .netcore, no javascript transpiling involved since I use the part that is intended for server side rendering .
This is even more F# idiomatic, fable-react is a better templating engine than razor. It is also more flexible.
thinkbeforecoding commentedon Oct 10, 2018
It would still be possible to provide for compatibility the tools for net47 that would integrate with the same version of razor than currently. This would be in a different nuget.
thinkbeforecoding commentedon Oct 10, 2018
This is also related to #469 .
matthid commentedon Oct 10, 2018
@thinkbeforecoding Please feel free to send a PR
thinkbeforecoding commentedon Oct 10, 2018
Sure,
I just wanted to know if it would have a chance to be merged before working on it 😄
wallymathieu commentedon Oct 10, 2018
One way to avoid problem with assembly load could be to use mono cecil to read the definitions. An example of that can be seen here: fsprojects/SyntacticVersioning#27
wallymathieu commentedon Oct 10, 2018
If you fix the issue it's very likely to get merged @thinkbeforecoding 😉
runefs commentedon Jan 17, 2019
any progress on this?
thinkbeforecoding commentedon Jan 17, 2019
Yes, it has been merged, and there's a nuget on the myget repository.
Details in my blog post:
https://thinkbeforecoding.com/post/2018/12/07/full-fsharp-blog