Skip to content

Commit 2dd840e

Browse files
Merge pull request #12 from thinkbeforecoding/fix/refload
Fix loading of net6.0 6.0.x
2 parents cffa5d5 + d5850c8 commit 2dd840e

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.2.1
2+
* Support for net6.0 version 6.0.1
3+
14
# 1.1.0
25
* Support for net 6.0
36

src/fasmi/Compilation.fs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ open System
33
open FileSystem
44
open FSharp.Compiler.CodeAnalysis
55

6-
// the Assembly attribute to build output as net5.0
6+
// the Assembly attribute to build output as net5.0/net6.0
77

88
let netAttr =
99
#if NET6_0
@@ -22,10 +22,10 @@ do ()
2222

2323
#endif
2424

25-
let netAttrName = "Net50AssemblyAttr.fs"
25+
let netAttrName = "NetAssemblyAttr.fs"
2626

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 =
2929
let filePath = dir asmPath </> netAttrName
3030
if not (IO.File.Exists filePath) then
3131
IO.File.WriteAllText(filePath, netAttr)
@@ -36,16 +36,20 @@ let ensureNet5Attr asmPath =
3636
let compile (path: string) (asmPath: string) =
3737
let checker = FSharpChecker.Create(keepAssemblyContents = true)
3838

39-
// fin net5.0 assembly path
40-
let net50Path =
39+
// find .net assembly path
40+
let netPath =
4141
let runtimeDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
4242
#if NET6_0
43-
IO.Path.GetFullPath(runtimeDir </> "../../../packs/Microsoft.NETCore.App.Ref/6.0.0/ref/net6.0/")
43+
44+
let packDir =
45+
IO.Directory.GetDirectories(runtimeDir </> "../../../packs/Microsoft.NETCore.App.Ref/", "6.0.*")
46+
|> Seq.max
47+
IO.Path.GetFullPath(packDir </> "ref/net6.0")
4448
#else
4549
IO.Path.GetFullPath(runtimeDir </> "../../../packs/Microsoft.NETCore.App.Ref/5.0.0/ref/net5.0/")
4650
#endif
4751

48-
let attrfile = ensureNet5Attr asmPath
52+
let attrfile = ensureNetAttr asmPath
4953

5054
let diag,_ =
5155
checker.Compile([| "fsc.exe"
@@ -72,7 +76,7 @@ let compile (path: string) (asmPath: string) =
7276
"--define:NETCOREAPP3_0_OR_GREATER"
7377
"--define:NETCOREAPP3_1_OR_GREATER"
7478
"--optimize+"
75-
for f in IO.Directory.EnumerateFiles(net50Path,"*.dll") do
79+
for f in IO.Directory.EnumerateFiles(netPath,"*.dll") do
7680
$"-r:{f}"
7781
|])
7882
|> Async.RunSynchronously

src/fasmi/fasmi.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PackageProjectUrl>https://github.com/d-edge/fasmi</PackageProjectUrl>
1818
<RepositoryUrl>https://github.com/d-edge/fasmi</RepositoryUrl>
1919
<PackageLicenseFile>LICENSE</PackageLicenseFile>
20-
<Version>1.2.0</Version>
20+
<Version>1.2.1</Version>
2121
</PropertyGroup>
2222
<ItemGroup>
2323
<Compile Include="FileSystem.fs" />

0 commit comments

Comments
 (0)