@@ -139,16 +139,9 @@ module internal MSBuildResolver =
139139 /// The list of supported .NET Framework version numbers, using the monikers of the Reference Assemblies folder.
140140 let SupportedNetFrameworkVersions = set [ Net20; Net30; Net35; Net40; Net45; Net451; (* SL only*) " v5.0" ]
141141
142- #if CROSS_ PLATFORM_ COMPILER
143- // Mono doesn't have GetPathToDotNetFramework. In this case we simply don't search this extra directory.
144- // When the x-plat compiler is run on Mono this is ok since implementation assembly folder is the same as the target framework folder.
145- // When the x-plat compiler is run on Windows/.NET this will curently cause slightly divergent behaviour.
146- let GetPathToDotNetFrameworkImlpementationAssemblies _v = []
147- #else
148142 /// Get the path to the .NET Framework implementation assemblies by using ToolLocationHelper.GetPathToDotNetFramework.
149143 /// This is only used to specify the "last resort" path for assembly resolution.
150144 let GetPathToDotNetFrameworkImlpementationAssemblies ( v ) =
151- #if FX_ ATLEAST_ 45
152145 let v =
153146 match v with
154147 | Net11 -> Some TargetDotNetFrameworkVersion.Version11
@@ -165,61 +158,18 @@ module internal MSBuildResolver =
165158 | null -> []
166159 | x -> [ x]
167160 | _ -> []
168- #else
169- // FX_ATLEAST_45 is not defined for step when we build compiler with proto compiler.
170- ignore v
171- []
172- #endif
173- #endif
174-
175-
176- #if CROSS_ PLATFORM_ COMPILER
177- // ToolLocationHelper.GetPathToDotNetFrameworkReferenceAssemblies is not available on Mono.
178- // We currently use the old values that the F# 2.0 compiler assumed.
179- // When the x-plat compiler is run on Mono this is ok since the asemblies are all in the framework folder
180- // When the x-plat compiler is run on Windows/.NET this will curently cause slightly divergent behaviour this directory
181- // may not be the same as the Microsoft compiler in all cases.
182- let GetPathToDotNetFrameworkReferenceAssembliesFor40Plus ( version ) =
183- match version with
184- | Net40 -> ReplaceVariablesForLegacyFxOnWindows([ @" {ReferenceAssemblies}\v4.0" ])
185- | Net45 -> ReplaceVariablesForLegacyFxOnWindows([ @" {ReferenceAssemblies}\v4.5" ])
186- | Net451 -> ReplaceVariablesForLegacyFxOnWindows([ @" {ReferenceAssemblies}\v4.5" ])
187- | _ -> []
188- #else
189161
190- let GetPathToDotNetFrameworkReferenceAssembliesFor40Plus ( version ) =
191- #if FX_ ATLEAST_ 45
192- // starting with .Net 4.0, the runtime dirs (WindowsFramework) are never used by MSBuild RAR
193- let v =
194- match version with
195- | Net40 -> Some TargetDotNetFrameworkVersion.Version40
196- | Net45 -> Some TargetDotNetFrameworkVersion.Version45
197- | Net451 -> Some TargetDotNetFrameworkVersion.Version451
198- | _ -> assert false ; None // unknown version - some parts in the code are not synced
199- match v with
200- | Some v ->
201- match ToolLocationHelper.GetPathToDotNetFrameworkReferenceAssemblies v with
202- | null -> []
203- | x -> [ x]
204- | None -> []
205- #else
206- // FX_ATLEAST_45 is not defined for step when we build compiler with proto compiler.
207- ignore version
208- []
209- #endif
210- #endif
211162
212- #if CROSS _ PLATFORM _ COMPILER
213- let HighestInstalledNetFrameworkVersionMajorMinor () =
214- // Mono doesn't have GetPathToDotNetFramework
215- 4 , Net40
216- #else
163+ let GetPathToDotNetFrameworkReferenceAssemblies ( version ) =
164+ match Microsoft.Build.Utilities.ToolLocationHelper.GetPathToStandardLibraries ( " .NETFramework " , version , " " ) with
165+ | null | " " -> []
166+ | x -> [ x ]
167+
217168 /// Use MSBuild to determine the version of the highest installed framework.
218169 let HighestInstalledNetFrameworkVersionMajorMinor () =
219170 if box ( ToolLocationHelper.GetPathToDotNetFramework( TargetDotNetFrameworkVersion.Version451)) <> null then 4 , Net451
220171 elif box ( ToolLocationHelper.GetPathToDotNetFramework( TargetDotNetFrameworkVersion.Version45)) <> null then 4 , Net45
221172 else 4 , Net40 // version is 4.0 assumed since this code is running.
222- #endif
223173
224174 /// Derive the target framework directories.
225175 let DeriveTargetFrameworkDirectories ( targetFrameworkVersion : string , logMessage ) =
@@ -228,13 +178,7 @@ module internal MSBuildResolver =
228178 if not ( targetFrameworkVersion.StartsWith( " v" , StringComparison.Ordinal)) then " v" + targetFrameworkVersion
229179 else targetFrameworkVersion
230180
231- let result =
232- if targetFrameworkVersion.StartsWith( Net10, StringComparison.Ordinal) then ReplaceVariablesForLegacyFxOnWindows([ @" {WindowsFramework}\v1.0.3705" ])
233- elif targetFrameworkVersion.StartsWith( Net11, StringComparison.Ordinal) then ReplaceVariablesForLegacyFxOnWindows([ @" {WindowsFramework}\v1.1.4322" ])
234- elif targetFrameworkVersion.StartsWith( Net20, StringComparison.Ordinal) then ReplaceVariablesForLegacyFxOnWindows([ @" {WindowsFramework}\v2.0.50727" ])
235- elif targetFrameworkVersion.StartsWith( Net30, StringComparison.Ordinal) then ReplaceVariablesForLegacyFxOnWindows([ @" {ReferenceAssemblies}\v3.0" ; @" {WindowsFramework}\v3.0" ; @" {WindowsFramework}\v2.0.50727" ])
236- elif targetFrameworkVersion.StartsWith( Net35, StringComparison.Ordinal) then ReplaceVariablesForLegacyFxOnWindows([ @" {ReferenceAssemblies}\v3.5" ; @" {WindowsFramework}\v3.5" ; @" {ReferenceAssemblies}\v3.0" ; @" {WindowsFramework}\v3.0" ; @" {WindowsFramework}\v2.0.50727" ])
237- else GetPathToDotNetFrameworkReferenceAssembliesFor40Plus( targetFrameworkVersion)
181+ let result = GetPathToDotNetFrameworkReferenceAssemblies( targetFrameworkVersion)
238182
239183 let result = result |> Array.ofList
240184 logMessage ( sprintf " Derived target framework directories for version %s are: %s " targetFrameworkVersion ( String.Join( " ," , result)))
0 commit comments