Skip to content

Commit daef337

Browse files
committed
Merge pull request #385 from dsyme/fix-381-31
fix-383 for F# 3.1
2 parents 192beb8 + 3f779a4 commit daef337

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

docs/content/corelib.fsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,31 @@ convert them to command-line arguments is to [crack an F# project file](http://f
6363
Alternatively you can compute SDK paths yourself, and some helpers to do this are in [the tests for FSharp.Compiler.Service.dll](https://github.com/fsharp/FSharp.Compiler.Service/blob/8a943dd3b545648690cb3bed652a469bdb6dd869/tests/service/Common.fs#L54).
6464
6565
66+
What about if I am processing a script or using ``GetCheckOptionsFromScriptRoot``
67+
-------------------------------------------------------------------------
68+
69+
If you do _not_ explicitly reference an FSharp.Core.dll from an SDK location, or if you are processing a script
70+
using ``FsiEvaluationSession`` or ``GetCheckOptionsFromScriptRoot``, then an implicit reference to FSharp.Core will be made
71+
by the following choice:
72+
73+
1. The version of FSharp.Core.dll statically referenced by the host assembly returned by ``System.Reflection.Assembly.GetEntryAssembly()``.
74+
75+
2. If there is no static reference to FSharp.Core in the host assembly, then
76+
77+
- For FSharp.Compiler.Service 0.x series, a reference to FSharp.Core version 4.3.0.0 is added
78+
79+
- For FSharp.Compiler.Service 1.3.1.x (F# 3.1 series), a reference to FSharp.Core version 4.3.1.0 is added
80+
81+
- For FSharp.Compiler.Service 1.4.0.x (F# 4.0 series), a reference to FSharp.Core version 4.4.0.0 is added
82+
6683
Do I need to include FSharp.Core.optdata and FSharp.Core.sigdata?
6784
--------------------------------------
6885
6986
If your compilation arguments explicitly reference an FSharp.Core.dll from an SDK location, then FSharp.Core.sigdata and FSharp.Core.optdata should be alongside the DLL
7087
(if these files are not installed, then that's a bug in the F# SDK installation). If your compilation
7188
arguments are always making an explicit reference, then you should _not_ include FSharp.Core.optdata and FSharp.Core.sigdata as part of your application.
7289
73-
74-
If you do _not_ explicitly reference an FSharp.Core.dll from an SDK location, then an implicit reference will be made
75-
to which ever version of FSharp.Core.dll your tool is running. This means your tool will almost certainly implicitly reference the FSharp.Core.dll
90+
If you are relying on an implicit reference (e.g. for script processing, see above), this means your tool may reference the FSharp.Core.dll
7691
that is part of your application. In this case, you may either get an error that FSharp.Core.optdata and FSharp.Core.sigdata are not
7792
found alongside FSharp.Core.dll. **If you want to implicitly reference the FSharp.Core.dll you are including in your application,
7893
then also add FSharp.Core.sigdata and FSharp.Core.optdata as two additional files to your application**. When using ``CompileToDynamicAssembly``, this problem

src/fsharp/build.fs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,10 +1575,8 @@ let GetFSharpCoreReferenceUsedByCompiler(useMonoResolution) =
15751575
match foundReference with
15761576
| Some fsharpCore -> fsharpCore
15771577
| None ->
1578-
typeof<TypeInThisAssembly>.Assembly.GetReferencedAssemblies()
1579-
|> Array.pick (fun name ->
1580-
if name.Name = fsCoreName then Some(name.ToString())
1581-
else None)
1578+
// FSharp.Compiler.Service for F# 3.1 defaults to FSharp.Core 4.3.1.0 if no FSharp.Core is referenced statically by the host process.
1579+
"FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
15821580

15831581
let GetFsiLibraryName () = "FSharp.Compiler.Interactive.Settings"
15841582
#endif

0 commit comments

Comments
 (0)