From 62e76b2dc9e8636b7645e3958211db39d19052ff Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 30 Dec 2025 15:18:43 +0000
Subject: [PATCH 1/6] Initial plan
From 058695deefd3a4441d31c69c0968e17cc9390f2a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 30 Dec 2025 15:33:09 +0000
Subject: [PATCH 2/6] Add FSharp.Core version validation implementation and
tests
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
---
.../Microsoft.FSharp.Core.NetSdk.props | 8 ++++--
.../Microsoft.FSharp.NetSdk.targets | 25 +++++++++++++++++
...SharpCoreVersion - HigherVersionWarns.proj | 12 +++++++++
...rpCoreVersion - LowerVersionNoWarning.proj | 12 +++++++++
...FSharpCoreVersion - PrereleaseParsing.proj | 12 +++++++++
...arpCoreVersion - SameVersionNoWarning.proj | 12 +++++++++
.../tests/FSharpCoreVersionTest.props | 23 ++++++++++++++++
.../tests/FSharpCoreVersionTest.targets | 27 +++++++++++++++++++
8 files changed, 129 insertions(+), 2 deletions(-)
create mode 100644 tests/fsharp/SDKTests/tests/FSharpCoreVersion - HigherVersionWarns.proj
create mode 100644 tests/fsharp/SDKTests/tests/FSharpCoreVersion - LowerVersionNoWarning.proj
create mode 100644 tests/fsharp/SDKTests/tests/FSharpCoreVersion - PrereleaseParsing.proj
create mode 100644 tests/fsharp/SDKTests/tests/FSharpCoreVersion - SameVersionNoWarning.proj
create mode 100644 tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props
create mode 100644 tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
diff --git a/src/FSharp.Build/Microsoft.FSharp.Core.NetSdk.props b/src/FSharp.Build/Microsoft.FSharp.Core.NetSdk.props
index 682dff8b1c2..faf65948eda 100644
--- a/src/FSharp.Build/Microsoft.FSharp.Core.NetSdk.props
+++ b/src/FSharp.Build/Microsoft.FSharp.Core.NetSdk.props
@@ -20,10 +20,14 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
-
- <_FSCorePackageVersionSet>true
+
+ true
{{FSCorePackageVersionValue}}
<_FSharpCoreLibraryPacksFolder Condition="'$(_FSharpCoreLibraryPacksFolder)' == ''">$([MSBuild]::EnsureTrailingSlash('$(MSBuildThisFileDirectory)'))library-packs
+
+ $([System.Version]::Parse('$(FSCorePackageVersion.Split('-')[0])').Major)
+
+
diff --git a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
index 292c55766a8..3d2c8c0c7f9 100644
--- a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
+++ b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
@@ -219,4 +219,29 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
@(_TopLevelSourceRoot->'%(EscapedKey)=%(EscapedValue)', ','),$(PathMap)
+
+
+
+
+
+ <_ResolvedFSharpCore Include="@(ReferencePath)"
+ Condition="'%(ReferencePath.NuGetPackageId)' == 'FSharp.Core'" />
+
+
+
+ <_ResolvedFSharpCoreVersion>%(_ResolvedFSharpCore.NuGetPackageVersion)
+ <_ResolvedFSharpCoreMajor>$([System.Version]::Parse('$(_ResolvedFSharpCoreVersion.Split('-')[0])').Major)
+ <_FSharpCoreVersionTooHigh Condition="$(_ResolvedFSharpCoreMajor) > $(FSharpCoreMaximumMajorVersion)">true
+
+
+
+
+
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersion - HigherVersionWarns.proj b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - HigherVersionWarns.proj
new file mode 100644
index 00000000000..9ba2d029328
--- /dev/null
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - HigherVersionWarns.proj
@@ -0,0 +1,12 @@
+
+
+ 8.0.100
+
+
+
+ 9.0.0
+ 8
+ true
+
+
+
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersion - LowerVersionNoWarning.proj b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - LowerVersionNoWarning.proj
new file mode 100644
index 00000000000..8ca4e3e34f2
--- /dev/null
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - LowerVersionNoWarning.proj
@@ -0,0 +1,12 @@
+
+
+ 9.0.100
+
+
+
+ 8.0.100
+ 9
+ false
+
+
+
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersion - PrereleaseParsing.proj b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - PrereleaseParsing.proj
new file mode 100644
index 00000000000..a01769c225a
--- /dev/null
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - PrereleaseParsing.proj
@@ -0,0 +1,12 @@
+
+
+ 9.0.100-preview.1
+
+
+
+ 10.0.0-beta.1
+ 9
+ true
+
+
+
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersion - SameVersionNoWarning.proj b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - SameVersionNoWarning.proj
new file mode 100644
index 00000000000..cc41e582443
--- /dev/null
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersion - SameVersionNoWarning.proj
@@ -0,0 +1,12 @@
+
+
+ 9.0.100
+
+
+
+ 9.0.200
+ 9
+ false
+
+
+
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props
new file mode 100644
index 00000000000..f9f69b278d1
--- /dev/null
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props
@@ -0,0 +1,23 @@
+
+
+
+
+
+ net8.0
+ <_TargetFrameworkVersionWithoutV>8.0
+ .NETCoreApp
+ Release
+ $(FSharpRepositoryPath)\artifacts\bin\FSharpSuite.Tests\$(Configuration)\$(TARGETFRAMEWORK)
+ AnyCPU
+ $(MSBuildThisFileDirectory)
+
+
+
+
+ $(TestFSCorePackageVersion)
+ true
+
+
+
+
+
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
new file mode 100644
index 00000000000..40aa1c58ae0
--- /dev/null
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+ <_TestResolvedMajor>$([System.Version]::Parse('$(TestResolvedVersion.Split('-')[0])').Major)
+ <_TestShouldWarn Condition="$(_TestResolvedMajor) > $(FSharpCoreMaximumMajorVersion)">true
+
+
+
+
+
+
+
+
+
+
+
+
+
From f65d23c55b0811c4b1d6c1a39c7e6dd19246624d Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 30 Dec 2025 15:39:22 +0000
Subject: [PATCH 3/6] Fix test framework version to net10.0
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
---
tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props
index f9f69b278d1..f558553bf6a 100644
--- a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.props
@@ -3,8 +3,8 @@
- net8.0
- <_TargetFrameworkVersionWithoutV>8.0
+ net10.0
+ <_TargetFrameworkVersionWithoutV>10.0
.NETCoreApp
Release
$(FSharpRepositoryPath)\artifacts\bin\FSharpSuite.Tests\$(Configuration)\$(TARGETFRAMEWORK)
From cbfab19189f508b8f6dc75afe48a9497ccfb78f6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 30 Dec 2025 15:43:38 +0000
Subject: [PATCH 4/6] Fix MSBuild property assignment syntax for item metadata
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
---
src/FSharp.Build/Microsoft.FSharp.NetSdk.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
index 3d2c8c0c7f9..c76da667e89 100644
--- a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
+++ b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
@@ -233,7 +233,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
- <_ResolvedFSharpCoreVersion>%(_ResolvedFSharpCore.NuGetPackageVersion)
+ <_ResolvedFSharpCoreVersion>@(_ResolvedFSharpCore->'%(NuGetPackageVersion)')
<_ResolvedFSharpCoreMajor>$([System.Version]::Parse('$(_ResolvedFSharpCoreVersion.Split('-')[0])').Major)
<_FSharpCoreVersionTooHigh Condition="$(_ResolvedFSharpCoreMajor) > $(FSharpCoreMaximumMajorVersion)">true
From 90ab65d73b4773afc9b1fced38be9699dac2ddde Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 30 Dec 2025 15:47:45 +0000
Subject: [PATCH 5/6] Improve MSBuild property function clarity and handle
multiple packages
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
---
src/FSharp.Build/Microsoft.FSharp.NetSdk.targets | 4 ++--
tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
index c76da667e89..0e313847897 100644
--- a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
+++ b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
@@ -232,9 +232,9 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
Condition="'%(ReferencePath.NuGetPackageId)' == 'FSharp.Core'" />
-
+
<_ResolvedFSharpCoreVersion>@(_ResolvedFSharpCore->'%(NuGetPackageVersion)')
- <_ResolvedFSharpCoreMajor>$([System.Version]::Parse('$(_ResolvedFSharpCoreVersion.Split('-')[0])').Major)
+ <_ResolvedFSharpCoreMajor>$([System.Version]::Parse($(_ResolvedFSharpCoreVersion.Split('-')[0])).Major)
<_FSharpCoreVersionTooHigh Condition="$(_ResolvedFSharpCoreMajor) > $(FSharpCoreMaximumMajorVersion)">true
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
index 40aa1c58ae0..ff3b7e556b4 100644
--- a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
@@ -7,7 +7,7 @@
- <_TestResolvedMajor>$([System.Version]::Parse('$(TestResolvedVersion.Split('-')[0])').Major)
+ <_TestResolvedMajor>$([System.Version]::Parse($(TestResolvedVersion.Split('-')[0])).Major)
<_TestShouldWarn Condition="$(_TestResolvedMajor) > $(FSharpCoreMaximumMajorVersion)">true
From 13d03606784c9e61bd84260fd3d7d7d44fc01929 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 30 Dec 2025 15:52:09 +0000
Subject: [PATCH 6/6] Add quotes in property function calls for consistency
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
---
src/FSharp.Build/Microsoft.FSharp.NetSdk.targets | 2 +-
tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
index 0e313847897..3761a84fad5 100644
--- a/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
+++ b/src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
@@ -234,7 +234,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<_ResolvedFSharpCoreVersion>@(_ResolvedFSharpCore->'%(NuGetPackageVersion)')
- <_ResolvedFSharpCoreMajor>$([System.Version]::Parse($(_ResolvedFSharpCoreVersion.Split('-')[0])).Major)
+ <_ResolvedFSharpCoreMajor>$([System.Version]::Parse('$(_ResolvedFSharpCoreVersion.Split('-')[0])').Major)
<_FSharpCoreVersionTooHigh Condition="$(_ResolvedFSharpCoreMajor) > $(FSharpCoreMaximumMajorVersion)">true
diff --git a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
index ff3b7e556b4..40aa1c58ae0 100644
--- a/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
+++ b/tests/fsharp/SDKTests/tests/FSharpCoreVersionTest.targets
@@ -7,7 +7,7 @@
- <_TestResolvedMajor>$([System.Version]::Parse($(TestResolvedVersion.Split('-')[0])).Major)
+ <_TestResolvedMajor>$([System.Version]::Parse('$(TestResolvedVersion.Split('-')[0])').Major)
<_TestShouldWarn Condition="$(_TestResolvedMajor) > $(FSharpCoreMaximumMajorVersion)">true