I'm trying to compile FsPickler on Mac.
The command line compilation works very well:
dotnet build -c Release
but when compiling the same project in Visual Studio (version 8.8), I start to get some compilation errors which have to do with the parsing of the files, which is really odd.
like this kind of errors:
the code it can't compile is this:
let currentLoadContext = lazy(
match Type.GetType "System.Runtime.Loader.AssemblyLoadContext" with
| null -> None
| ty ->
match ty.GetProperty "Assemblies" with
| null -> None // property not available in netcoreapp < 3.0
| assembliesProperty ->
let loadContextM = ty.GetMethod("GetLoadContext", BindingFlags.Public ||| BindingFlags.Static, null, [|typeof<Assembly>|], null)
let loadFromNameM = ty.GetMethod("LoadFromAssemblyName", BindingFlags.Public ||| BindingFlags.Instance, null, [|typeof<AssemblyName>|], null)
let asm = Assembly.GetExecutingAssembly()
let currentLoadContext = loadContextM.Invoke(null, [|asm|])
let getContextAssemblies () = assembliesProperty.GetValue(currentLoadContext) :?> seq<Assembly> |> Seq.toArray
let loadFromAssemblyName (an : AssemblyName) = loadFromNameM.Invoke(currentLoadContext, [|an|]) :?> Assembly
Some {| LoadContext = currentLoadContext ; GetCurrentAssemblies = getContextAssemblies ; LoadFromAssemblyName = loadFromAssemblyName |})
but it's not really relevant to the problem.
When I look at the details, I see that:
Target CoreCompile:
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/fsharp/fsc.exe -o:obj/Debug/netstandard2.0/FsPickler.dll
and I'm now questioning: why do I even have Mono installed and what does Mono have to do with compiling the .net code with Visual Studio?
If I compile the same project with Rider, it works, with the command line, it works but with Visual Studio I get the errors above and a compiler coming from a Mono folder.
Can anyone shed some light as to why Mono is involved and if there are two versions of the compiler?
