diff --git a/Directory.Build.props b/Directory.Build.props
index 08a1434cdc1..1c34ff37fc8 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -74,6 +74,8 @@
Cannot live in eng/TargetFrameworks.props because it's imported before Arcade. -->
$(NetCurrent)
+
+ $(NetCurrent)
+
+
+ TargetFramework=netstandard2.1
+
+
+
net10.0
diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj
index 565fab62a04..be193aa3bbb 100644
--- a/src/FSharp.Core/FSharp.Core.fsproj
+++ b/src/FSharp.Core/FSharp.Core.fsproj
@@ -5,7 +5,7 @@
Library
netstandard2.0
- netstandard2.0;netstandard2.1
+ netstandard2.0;netstandard2.1;$(FSharpCoreShippedNetTargetFramework)
$(NoWarn);75
$(NoWarn);1204
true
@@ -36,6 +36,11 @@
Debug;Release;Proto
+
+
+
+
+
$(OtherFlags) --realsig-
diff --git a/src/FSharp.Core/FSharp.Core.nuspec b/src/FSharp.Core/FSharp.Core.nuspec
index cc7e5316ac6..a32a54e5382 100644
--- a/src/FSharp.Core/FSharp.Core.nuspec
+++ b/src/FSharp.Core/FSharp.Core.nuspec
@@ -6,6 +6,7 @@
+
@@ -22,5 +23,11 @@
+
+
+
+
+
+
diff --git a/src/FSharp.Core/Query.fs b/src/FSharp.Core/Query.fs
index 715894dd34a..61e2d2906db 100644
--- a/src/FSharp.Core/Query.fs
+++ b/src/FSharp.Core/Query.fs
@@ -107,7 +107,7 @@ type QueryBuilder() =
member _.Head (source: QuerySource<'T, 'Q>) =
Enumerable.First source.Source
- member _.Nth (source: QuerySource<'T, 'Q>, index) =
+ member _.Nth (source: QuerySource<'T, 'Q>, index: int) =
Enumerable.ElementAt (source.Source, index)
member _.Skip (source: QuerySource<'T, 'Q>, count) : QuerySource<'T, 'Q> =
@@ -116,7 +116,7 @@ type QueryBuilder() =
member _.SkipWhile (source: QuerySource<'T, 'Q>, predicate) : QuerySource<'T, 'Q> =
QuerySource (Enumerable.SkipWhile (source.Source, Func<_, _>(predicate)))
- member _.Take (source: QuerySource<'T, 'Q>, count) : QuerySource<'T, 'Q> =
+ member _.Take (source: QuerySource<'T, 'Q>, count: int) : QuerySource<'T, 'Q> =
QuerySource (Enumerable.Take (source.Source, count))
member _.TakeWhile (source: QuerySource<'T, 'Q>, predicate) : QuerySource<'T, 'Q> =
@@ -246,7 +246,7 @@ type QueryBuilder() =
QuerySource (Enumerable.GroupJoin(outerSource.Source, innerSource.Source, Func<_, _>(outerKeySelector), Func<_, _>(innerKeySelector), Func<_, _, _>(resultSelector)))
member _.LeftOuterJoin (outerSource: QuerySource<_, 'Q>, innerSource: QuerySource<_, 'Q>, outerKeySelector, innerKeySelector, resultSelector: _ -> seq<_> -> _) : QuerySource<_, 'Q> =
- QuerySource (Enumerable.GroupJoin(outerSource.Source, innerSource.Source, Func<_, _>(outerKeySelector), Func<_, _>(innerKeySelector), Func<_, _, _>(fun x g -> resultSelector x (g.DefaultIfEmpty()))))
+ QuerySource (Enumerable.GroupJoin(outerSource.Source, innerSource.Source, Func<_, _>(outerKeySelector), Func<_, _>(innerKeySelector), Func<_, _, _>(fun x (g: seq<_>) -> resultSelector x (g.DefaultIfEmpty()))))
member _.RunQueryAsValue (q: Quotations.Expr<'T>) : 'T =
ForwardDeclarations.Query.Execute q
@@ -475,8 +475,8 @@ module Query =
MakeOrCallContainsOrElementAt FQ FE
let MakeElementAt, CallElementAt =
- let FQ = methodhandleof (fun (x, y) -> Queryable.ElementAt(x, y))
- let FE = methodhandleof (fun (x, y) -> Enumerable.ElementAt(x, y))
+ let FQ = methodhandleof (fun (x, y) -> Queryable.ElementAt(x, (y: int)))
+ let FE = methodhandleof (fun (x, y) -> Enumerable.ElementAt(x, (y: int)))
MakeOrCallContainsOrElementAt FQ FE
let MakeOrCallMinByOrMaxBy FQ FE =
@@ -886,8 +886,8 @@ module Query =
let MakeTake =
MakeSkipOrTake
- (methodhandleof (fun (x, y) -> Queryable.Take (x, y)))
- (methodhandleof (fun (x, y) -> Enumerable.Take (x, y)))
+ (methodhandleof (fun (x, y) -> Queryable.Take (x, (y: int))))
+ (methodhandleof (fun (x, y) -> Enumerable.Take (x, (y: int))))
let MakeSkipWhile =
GenMakeSkipWhileOrTakeWhile
diff --git a/src/FSharp.Core/local.fs b/src/FSharp.Core/local.fs
index 16654a06257..c365f9e5bdb 100644
--- a/src/FSharp.Core/local.fs
+++ b/src/FSharp.Core/local.fs
@@ -10,17 +10,17 @@ module internal DetailedExceptions =
open Microsoft.FSharp.Core
/// takes an argument, a formatting string, a param array to splice into the formatting string
- let inline invalidArgFmt (arg:string) (format:string) paramArray =
+ let inline invalidArgFmt (arg:string) (format:string) (paramArray: obj[]) =
let msg = String.Format (format, paramArray)
raise (ArgumentException(msg, arg))
/// takes an argument, a formatting string, a param array to splice into the formatting string
- let inline invalidArgOutOfRangeFmt (arg:string) (format:string) paramArray =
+ let inline invalidArgOutOfRangeFmt (arg:string) (format:string) (paramArray: obj[]) =
let msg = String.Format (format, paramArray)
raise (ArgumentOutOfRangeException(arg, msg))
/// takes a formatting string and a param array to splice into the formatting string
- let inline invalidOpFmt (format:string) paramArray =
+ let inline invalidOpFmt (format:string) (paramArray: obj[]) =
let msg = String.Format (format, paramArray)
raise (InvalidOperationException(msg))
diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs
index 036ba49ce48..5ee0a4e2ff8 100644
--- a/src/FSharp.Core/prim-types.fs
+++ b/src/FSharp.Core/prim-types.fs
@@ -443,13 +443,14 @@ namespace System.Diagnostics.CodeAnalysis
member this.DynamicallyAccessedMembersAttribute(memberTypes: DynamicallyAccessedMemberTypes) =
this.MemberTypes <- memberTypes
+#endif
+
namespace Microsoft.FSharp.Core
open System
open System.Collections
open System.Collections.Generic
open System.Globalization
open System.Reflection
- #endif
[] type float<[] 'Measure> = float
[] type float32<[] 'Measure> = float32
@@ -4096,6 +4097,7 @@ namespace Microsoft.FSharp.Core
and 'T voption = ValueOption<'T>
// These attributes only exist in .NET 8 and up.
+#if !NET8_0_OR_GREATER
namespace System.Runtime.CompilerServices
open System
open Microsoft.FSharp.Core
@@ -4111,6 +4113,7 @@ namespace System.Runtime.CompilerServices
[]
type internal ScopedRefAttribute () =
inherit Attribute ()
+#endif
namespace Microsoft.FSharp.Collections
@@ -4128,7 +4131,7 @@ namespace Microsoft.FSharp.Collections
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions
open Microsoft.FSharp.Core.BasicInlinedOperations
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
[, "Create")>]
#endif
[]
@@ -4156,7 +4159,7 @@ namespace Microsoft.FSharp.Collections
and 'T list = List<'T>
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
and []
type SupportsWhenTEnum = class end
+#if !NET5_0_OR_GREATER
namespace System.Diagnostics.CodeAnalysis
open System
@@ -1047,6 +1048,8 @@ namespace System.Diagnostics.CodeAnalysis
new: DynamicallyAccessedMemberTypes -> DynamicallyAccessedMembersAttribute
member MemberTypes: DynamicallyAccessedMemberTypes
+#endif
+
namespace Microsoft.FSharp.Core
open System
@@ -2606,6 +2609,7 @@ namespace Microsoft.FSharp.Core
| Error of ErrorValue:'TError
// These attributes only exist in .NET 8 and up.
+#if !NET8_0_OR_GREATER
namespace System.Runtime.CompilerServices
open System
open Microsoft.FSharp.Core
@@ -2637,6 +2641,7 @@ namespace System.Runtime.CompilerServices
type internal ScopedRefAttribute =
inherit Attribute
new: unit -> ScopedRefAttribute
+#endif
namespace Microsoft.FSharp.Collections
@@ -2654,7 +2659,7 @@ namespace Microsoft.FSharp.Collections
///
///
///
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
[, "Create")>]
#endif
[]
@@ -2730,7 +2735,7 @@ namespace Microsoft.FSharp.Collections
///
and 'T list = List<'T>
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
/// Contains methods for compiler use related to lists.
and [ add comparer k acc) empty l
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
[, "Create")>]
#endif
[]
@@ -1097,7 +1097,7 @@ type Set<[] 'T when 'T: comparison>(comparer: IComparer<'
.Append("; ... ]")
.ToString()
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
and [See the module for further operations on sets.
///
/// All members of this class are thread-safe and may be used concurrently from multiple threads.
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
[, "Create")>]
#endif
[]
@@ -263,7 +263,7 @@ type Set<[] 'T when 'T: comparison> =
interface System.Collections.IStructuralEquatable
interface IReadOnlyCollection<'T>
-#if NETSTANDARD2_1_OR_GREATER
+#if NETSTANDARD2_1_OR_GREATER || NET
/// Contains methods for compiler use related to sets.
and [, body: 'T -> TaskCode<'TOverall, unit>) : TaskCode<'TOverall, unit> =
ResumableCode.For(sequence, body)
-#if NETSTANDARD2_1
+#if NETSTANDARD2_1 || NET
member inline internal this.TryFinallyAsync
(body: TaskCode<'TOverall, 'T>, compensation: unit -> ValueTask)
: TaskCode<'TOverall, 'T> =
diff --git a/src/FSharp.Core/tasks.fsi b/src/FSharp.Core/tasks.fsi
index 76d84bcfd28..95f1bd1be2b 100644
--- a/src/FSharp.Core/tasks.fsi
+++ b/src/FSharp.Core/tasks.fsi
@@ -93,7 +93,7 @@ type TaskBuilderBase =
member inline TryWith:
body: TaskCode<'TOverall, 'T> * catch: (exn -> TaskCode<'TOverall, 'T>) -> TaskCode<'TOverall, 'T>
-#if NETSTANDARD2_1
+#if NETSTANDARD2_1 || NET
///
/// Specifies a unit of task code which binds to the resource implementing IAsyncDisposable and disposes it asynchronously
///
diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj
index ec0704c0cf1..f31891bc587 100644
--- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj
+++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj
@@ -45,7 +45,7 @@
TargetFrameworks=netstandard2.0
- TargetFrameworks=netstandard2.1;netstandard2.0
+ TargetFrameworks=netstandard2.1;netstandard2.0;$(FSharpCoreShippedNetTargetFramework)
TargetFrameworks=netstandard2.0
diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj
index 8e73f8974c7..302032bf7b6 100644
--- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj
+++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj
@@ -210,6 +210,12 @@
TargetFramework=netstandard2.0
+
+
+ TargetFramework=netstandard2.1
+