From 66a5034e7896c5f17e739bc1f80859eda81c48aa Mon Sep 17 00:00:00 2001
From: Tomas Grosup <tomasgrosup@microsoft.com>
Date: Thu, 28 May 2026 11:03:14 +0200
Subject: [PATCH 1/2] Fix source-build: track System.Security.Cryptography.Xml
 via Version.Details

Move System.Security.Cryptography.Xml version management from hardcoded
eng/Versions.props to eng/Version.Details.xml + Version.Details.props,
following the same pattern as System.Diagnostics.DiagnosticSource and
other System.* runtime dependencies. This allows source-build to use
the live-built package instead of a prebuilt NuGet download.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 eng/Version.Details.props            | 2 ++
 eng/Version.Details.xml              | 6 ++++++
 eng/Versions.props                   | 1 -
 src/FSharp.Build/FSharp.Build.fsproj | 2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/eng/Version.Details.props b/eng/Version.Details.props
index 82ad65afb5a..27fe3ea88b2 100644
--- a/eng/Version.Details.props
+++ b/eng/Version.Details.props
@@ -32,6 +32,7 @@ This file should be imported by eng/Versions.props
     <SystemCompositionPackageVersion>10.0.2</SystemCompositionPackageVersion>
     <SystemDiagnosticsDiagnosticSourcePackageVersion>10.0.2</SystemDiagnosticsDiagnosticSourcePackageVersion>
     <SystemReflectionMetadataPackageVersion>10.0.2</SystemReflectionMetadataPackageVersion>
+    <SystemSecurityCryptographyXmlPackageVersion>10.0.8</SystemSecurityCryptographyXmlPackageVersion>
   </PropertyGroup>
   <!--Property group for alternate package version names-->
   <PropertyGroup>
@@ -62,5 +63,6 @@ This file should be imported by eng/Versions.props
     <SystemCompositionVersion>$(SystemCompositionPackageVersion)</SystemCompositionVersion>
     <SystemDiagnosticsDiagnosticSourceVersion>$(SystemDiagnosticsDiagnosticSourcePackageVersion)</SystemDiagnosticsDiagnosticSourceVersion>
     <SystemReflectionMetadataVersion>$(SystemReflectionMetadataPackageVersion)</SystemReflectionMetadataVersion>
+    <SystemSecurityCryptographyXmlVersion>$(SystemSecurityCryptographyXmlPackageVersion)</SystemSecurityCryptographyXmlVersion>
   </PropertyGroup>
 </Project>
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 07b9c1ce026..80f7750a1f0 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -74,6 +74,12 @@
       <Sha>
       </Sha>
     </Dependency>
+    <!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
+    <Dependency Name="System.Security.Cryptography.Xml" Version="10.0.8">
+      <Uri>https://github.com/dotnet/runtime</Uri>
+      <Sha>
+      </Sha>
+    </Dependency>
   </ProductDependencies>
   <ToolsetDependencies>
     <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.26275.1">
diff --git a/eng/Versions.props b/eng/Versions.props
index 9f6b9d7b201..64e545f6118 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -89,7 +89,6 @@
     <SystemBuffersVersion>4.6.1</SystemBuffersVersion>
     <SystemMemoryVersion>4.6.3</SystemMemoryVersion>
     <SystemRuntimeCompilerServicesUnsafeVersion>6.1.2</SystemRuntimeCompilerServicesUnsafeVersion>
-    <SystemSecurityCryptographyXmlVersion>10.0.8</SystemSecurityCryptographyXmlVersion>
     <!-- System.* packages from dotnet/runtime are managed in Version.Details.xml / Version.Details.props for source-build. -->
   </PropertyGroup>
 
diff --git a/src/FSharp.Build/FSharp.Build.fsproj b/src/FSharp.Build/FSharp.Build.fsproj
index d7f814ce261..b2552dbe7ee 100644
--- a/src/FSharp.Build/FSharp.Build.fsproj
+++ b/src/FSharp.Build/FSharp.Build.fsproj
@@ -89,7 +89,7 @@
     <PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" />
     <PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
     <PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" />
-    <PackageReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" PrivateAssets="all" />
+    <PackageReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" />
     <PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
     <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
   </ItemGroup>

From c8ed4d40aa33e90ac66d1208d8590844ee7f89ba Mon Sep 17 00:00:00 2001
From: Copilot <copilot@github.com>
Date: Thu, 28 May 2026 17:12:29 +0200
Subject: [PATCH 2/2] Restore PrivateAssets=all on
 System.Security.Cryptography.Xml

Removing PrivateAssets=all caused transitive dependencies
(Microsoft.Bcl.Cryptography, System.Formats.Asn1, etc.) to flow into
fsc.fsproj on net472, triggering MSB3277 version conflicts with
System.ValueTuple from .NET Framework reference assemblies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 src/FSharp.Build/FSharp.Build.fsproj | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/FSharp.Build/FSharp.Build.fsproj b/src/FSharp.Build/FSharp.Build.fsproj
index b2552dbe7ee..d7f814ce261 100644
--- a/src/FSharp.Build/FSharp.Build.fsproj
+++ b/src/FSharp.Build/FSharp.Build.fsproj
@@ -89,7 +89,7 @@
     <PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" />
     <PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
     <PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" />
-    <PackageReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" />
+    <PackageReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" PrivateAssets="all" />
     <PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
     <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
   </ItemGroup>
