@@ -3,7 +3,7 @@ open System
3
3
open FileSystem
4
4
open FSharp.Compiler .CodeAnalysis
5
5
6
- // the Assembly attribute to build output as net5.0
6
+ // the Assembly attribute to build output as net5.0/net6.0
7
7
8
8
let netAttr =
9
9
#if NET6_ 0
@@ -22,10 +22,10 @@ do ()
22
22
23
23
#endif
24
24
25
- let netAttrName = " Net50AssemblyAttr .fs"
25
+ let netAttrName = " NetAssemblyAttr .fs"
26
26
27
- // check the net5.0 assembly attribute file exists or create it
28
- let ensureNet5Attr asmPath =
27
+ // check the net5.0/net6.0 assembly attribute file exists or create it
28
+ let ensureNetAttr asmPath =
29
29
let filePath = dir asmPath </> netAttrName
30
30
if not ( IO.File.Exists filePath) then
31
31
IO.File.WriteAllText( filePath, netAttr)
@@ -36,22 +36,20 @@ let ensureNet5Attr asmPath =
36
36
let compile ( path : string ) ( asmPath : string ) =
37
37
let checker = FSharpChecker.Create( keepAssemblyContents = true )
38
38
39
- // fin net5.0 assembly path
40
- let net50Path =
39
+ // find .net assembly path
40
+ let netPath =
41
41
let runtimeDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
42
42
#if NET6_ 0
43
43
44
44
let packDir =
45
45
IO.Directory.GetDirectories( runtimeDir </> " ../../../packs/Microsoft.NETCore.App.Ref/" , " 6.0.*" )
46
46
|> Seq.max
47
47
IO.Path.GetFullPath( packDir </> " ref/net6.0" )
48
-
49
- //IO.Path.GetFullPath(runtimeDir </> "../../../packs/Microsoft.NETCore.App.Ref/6.0.0/ref/net6.0/")
50
48
#else
51
49
IO.Path.GetFullPath( runtimeDir </> " ../../../packs/Microsoft.NETCore.App.Ref/5.0.0/ref/net5.0/" )
52
50
#endif
53
51
54
- let attrfile = ensureNet5Attr asmPath
52
+ let attrfile = ensureNetAttr asmPath
55
53
56
54
let diag , _ =
57
55
checker.Compile([| " fsc.exe"
@@ -78,7 +76,7 @@ let compile (path: string) (asmPath: string) =
78
76
" --define:NETCOREAPP3_0_OR_GREATER"
79
77
" --define:NETCOREAPP3_1_OR_GREATER"
80
78
" --optimize+"
81
- for f in IO.Directory.EnumerateFiles( net50Path , " *.dll" ) do
79
+ for f in IO.Directory.EnumerateFiles( netPath , " *.dll" ) do
82
80
$" -r:{f}"
83
81
|])
84
82
|> Async.RunSynchronously
0 commit comments