未验证 提交 6c3b97f9 编写于 作者: K Kevin Ransom (msft) 提交者: GitHub

Improven netcore implementation references (#7966)

上级 fbcbc8ee
......@@ -130,12 +130,17 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies
if not (assemblies.ContainsKey(referenceName)) then
try
assemblies.Add(referenceName, path) |> ignore
if referenceName <> "System.Private.CoreLib" then
let asm = System.Reflection.Assembly.LoadFrom(path)
for reference in asm.GetReferencedAssemblies() do
// System.Private.CoreLib doesn't load with reflection
traverseDependencies reference.Name
if File.Exists(path) then
// System.Private.CoreLib doesn't load with reflection
if referenceName = "System.Private.CoreLib" then
assemblies.Add(referenceName, path)
else
try
let asm = System.Reflection.Assembly.LoadFrom(path)
assemblies.Add(referenceName, path)
for reference in asm.GetReferencedAssemblies() do
traverseDependencies reference.Name
with e -> ()
with e -> ()
assemblyReferences |> List.iter(traverseDependencies)
......@@ -193,7 +198,7 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies
let getImplementationReferences () =
// Coreclr supports netstandard assemblies only for now
(getDependenciesOf [
yield Path.Combine(implementationAssemblyDir, "netstandard.dll")
yield! Directory.GetFiles(implementationAssemblyDir, "*.dll")
yield getDefaultFSharpCoreReference
if useFsiAuxLib then yield getFsiLibraryName
]).Values |> Seq.toList
......
......@@ -32,7 +32,11 @@ type FSharpScript(?captureInput: bool, ?captureOutput: bool, ?additionalArgs: st
())()
let config = FsiEvaluationSession.GetDefaultConfiguration()
let baseArgs = [| this.GetType().Assembly.Location; "--noninteractive"; "--targetprofile:netcore"; "--quiet" |]
let computedProfile =
// If we are being executed on the desktop framework (we can tell because the assembly containing int is mscorlib) then profile must be mscorlib otherwise use netcore
if typeof<int>.Assembly.GetName().Name = "mscorlib" then "mscorlib"
else "netcore"
let baseArgs = [| this.GetType().Assembly.Location; "--noninteractive"; "--targetprofile:" + computedProfile; "--quiet" |]
let argv = Array.append baseArgs additionalArgs
let fsi = FsiEvaluationSession.Create (config, argv, stdin, stdout, stderr, collectible=true)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册