@@ -171,8 +171,10 @@ let AdjustForScriptCompile(tcConfigB:TcConfigBuilder,commandLineSourceFiles,lexR
171171let AppendClosureInformation ( filename ) =
172172if IsScript filenamethen
173173let closure = LoadClosure.ComputeClosureOfSourceFiles( tcConfig,[ filename, rangeStartup], CodeContext.Compilation, lexResourceManager= lexResourceManager, useDefaultScriptingReferences= false )
174- let references = closure.References|> List.map snd|> List.concat|> List.map( fun r -> r.originalReference) |> List.filter( fun r -> r.Range<> range0)
175- references|> List.iter( fun r -> tcConfigB.AddReferencedAssemblyByPath( r.Range, r.Text))
174+ // Record the references from the analysis of the script. The full resolutions are recorded as the corresponding #I paths used to resolve them
175+ // are local to the scripts and not added to the tcConfigB (they are added to localized clones of the tcConfigB).
176+ let references = closure.References|> List.map snd|> List.concat|> List.filter( fun r -> r.originalReference.Range<> range0)
177+ references|> List.iter( fun r -> tcConfigB.AddReferencedAssemblyByPath( r.originalReference.Range, r.resolvedPath))
176178 closure.NoWarns|> List.map( fun ( n , ms ) -> ms|> List.map( fun m -> m, n)) |> List.concat|> List.iter tcConfigB.TurnWarningOff
177179 closure.SourceFiles|> List.map fst|> List.iter AddIfNotPresent
178180 closure.RootWarnings|> List.iter warnSink