Skip to content

Commit 6a548ca

Browse files
authored
Fix # 5514 (#5516)
1 parent 77e6267 commit 6a548ca

File tree

2 files changed

+10
-45
lines changed

2 files changed

+10
-45
lines changed

src/utils/CompilerLocationUtils.fs

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -217,31 +217,13 @@ module internal FSharpEnvironment =
217217
match probePoint with
218218
| Some p when safeExists (Path.Combine(p,"FSharp.Core.dll")) -> Some p
219219
| _ ->
220-
221-
// On windows the location of the compiler is via a registry key
222-
223-
// Note: If the keys below change, be sure to update code in:
224-
// Property pages (ApplicationPropPage.vb)
225-
let keys =
226-
[|
227-
@"Software\Microsoft\FSharp\10.1\Runtime\v4.0";
228-
@"Software\Microsoft\FSharp\4.1\Runtime\v4.0";
229-
@"Software\Microsoft\FSharp\4.0\Runtime\v4.0"
230-
|]
231-
let path = keys |> Seq.tryPick(fun k -> tryRegKey k)
232-
match path with
233-
| Some _ -> path
234-
| None ->
235-
// On Unix we let you set FSHARP_COMPILER_BIN. I've rarely seen this used and its not documented in the install instructions.
236-
let result =
237-
let var = System.Environment.GetEnvironmentVariable("FSHARP_COMPILER_BIN")
238-
if String.IsNullOrEmpty(var) then None
239-
else Some(var)
240-
match result with
241-
| Some _ -> result
242-
| None ->
243-
// For the prototype compiler, we can just use the current domain
244-
tryCurrentDomain()
220+
// We let you set FSHARP_COMPILER_BIN. I've rarely seen this used and its not documented in the install instructions.
221+
let result = System.Environment.GetEnvironmentVariable("FSHARP_COMPILER_BIN")
222+
if not (String.IsNullOrEmpty(result)) then
223+
Some result
224+
else
225+
// For the prototype compiler, we can just use the current domain
226+
tryCurrentDomain()
245227
with e ->
246228
System.Diagnostics.Debug.Assert(false, "Error while determining default location of F# compiler")
247229
None

vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/ApplicationPropPage.vb

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages
4949
Protected Const INDEX_WINDOWSCLASSLIB As Integer = 2
5050
Protected Const INDEX_LAST As Integer = INDEX_WINDOWSCLASSLIB
5151
Public Const Const_TargetFrameworkMoniker As String = "TargetFrameworkMoniker"
52-
Private m_v20FSharpRedistInstalled As Boolean = False
53-
Private m_v40FSharpRedistInstalled As Boolean = False
5452

5553
Friend WithEvents TargetFramework As System.Windows.Forms.ComboBox
5654
Friend WithEvents TargetFrameworkLabel As System.Windows.Forms.Label
@@ -75,12 +73,6 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages
7573
m_OutputTypeStringKeys(INDEX_COMMANDLINEAPP) = SR.GetString(SR.PPG_CommandLineApp)
7674
m_OutputTypeStringKeys(INDEX_WINDOWSCLASSLIB) = SR.GetString(SR.PPG_WindowsClassLib)
7775

78-
Dim v20FSharpRedistKey As String = "HKEY_LOCAL_MACHINE\Software\Microsoft\FSharp\10.1\Runtime\v2.0"
79-
Dim v40FSharpRedistKey As String = "HKEY_LOCAL_MACHINE\Software\Microsoft\FSharp\10.1\Runtime\v4.0"
80-
81-
m_v20FSharpRedistInstalled = Not (IsNothing(Microsoft.Win32.Registry.GetValue(v20FSharpRedistKey, Nothing, Nothing)))
82-
m_v40FSharpRedistInstalled = Not (IsNothing(Microsoft.Win32.Registry.GetValue(v40FSharpRedistKey, Nothing, Nothing)))
83-
8476
'Add any initialization after the InitializeComponent() call
8577
AddChangeHandlers()
8678

@@ -587,18 +579,9 @@ Namespace Microsoft.VisualStudio.Editors.PropertyPages
587579
If moniker.StartsWith(".NETCoreApp") OrElse moniker.StartsWith(".NETStandard") Then
588580
Return True
589581
End If
590-
If moniker.Contains("v2") Then
591-
Return Me.m_v20FSharpRedistInstalled
592-
End If
593-
If moniker.Contains("v3.0") Then
594-
Return Me.m_v20FSharpRedistInstalled
595-
End If
596-
If moniker.Contains("v3.5") Then
597-
Return Me.m_v20FSharpRedistInstalled
598-
End If
599-
'' Is this cheating?
600-
If moniker.Contains("v4") Then
601-
Return Me.m_v40FSharpRedistInstalled
582+
' With the latest tooling, if we have editors the redist is installed by definition
583+
If moniker.Contains("v2") Or moniker.Contains("v3.0") Or moniker.Contains("v3.5") Or moniker.Contains("v4") Then
584+
Return True
602585
End If
603586
Return False
604587
End Function

0 commit comments

Comments
 (0)