@@ -12,11 +12,6 @@ open System.Runtime.Versioning
1212
1313open Internal.Utilities .FSharpEnvironment
1414
15- #if !( NETSTANDARD || NETCOREAPP)
16- open Microsoft.Build .Evaluation
17- open Microsoft.Build .Framework
18- #endif
19-
2015[<AttributeUsage( AttributeTargets.Assembly ||| AttributeTargets.Class , AllowMultiple = false ) >]
2116type DependencyManagerAttribute () = inherit System.Attribute()
2217
@@ -86,7 +81,6 @@ module Utilities =
8681
8782 let sdks = " Sdks"
8883
89- #if !( NETSTANDARD || NETCOREAPP)
9084 let msbuildExePath =
9185 // Find msbuild.exe when invoked from desktop compiler.
9286 // 1. Look relative to F# compiler location Normal retail build
@@ -120,7 +114,7 @@ module Utilities =
120114 | _ -> None
121115
122116 roots |> Array.tryFind( fun root -> msbuildPathExists root) |> msbuildOption
123- #else
117+
124118 let dotnetHostPath =
125119 // How to find dotnet.exe --- woe is me; probing rules make me sad.
126120 // Algorithm:
@@ -156,7 +150,6 @@ module Utilities =
156150 Some dotnet
157151 else
158152 None
159- #endif
160153
161154 let drainStreamToFile ( stream : StreamReader ) filename =
162155 use file = File.OpenWrite( filename)
@@ -210,13 +203,13 @@ module Utilities =
210203 let workingDir = Path.GetDirectoryName projectPath
211204
212205 let succeeded =
213- #if !( NETSTANDARD || NETCOREAPP )
214- // The Desktop build uses "msbuild" to build
215- executeBuild msbuildExePath ( arguments " " ) workingDir
216- # else
217- // The coreclr uses "dotnet msbuild" to build
218- executeBuild dotnetHostPath ( arguments " msbuild" ) workingDir
219- #endif
206+ if not ( isRunningOnCoreClr ) then
207+ // The Desktop build uses "msbuild" to build
208+ executeBuild msbuildExePath ( arguments " " ) workingDir
209+ else
210+ // The coreclr uses "dotnet msbuild" to build
211+ executeBuild dotnetHostPath ( arguments " msbuild" ) workingDir
212+
220213 let outputFile = projectPath + " .fsx"
221214 let resultOutFile = if succeeded && File.Exists( outputFile) then Some outputFile else None
222215 succeeded, resultOutFile
0 commit comments