Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9edea1b
Add centralized product TFM file and expose via MSBuild and F# constants
T-Gro Jan 29, 2026
135f046
Replace hardcoded net10.0 with $(FSharpNetCoreProductDefaultTargetFra…
T-Gro Jan 29, 2026
e8e4a6f
Update build scripts to read TFM from eng/productTfm.txt
T-Gro Jan 29, 2026
33a5b60
Update build scripts to read TFM from eng/productTfm.txt
T-Gro Jan 29, 2026
6cc4a6d
Update CompilerLocation.fs to use fsProductTfmMajorVersion
T-Gro Jan 29, 2026
52b8f19
Update CompilerLocation.fs to use fsProductTfmMajorVersion
T-Gro Jan 29, 2026
92afd5e
Add productTfm constant to test utilities
T-Gro Jan 29, 2026
543c80f
Add productTfm constant to test utilities
T-Gro Jan 29, 2026
6db29fe
Centralize TFM in test files using TestFramework.productTfm
T-Gro Jan 29, 2026
0be589e
Centralize TFM in test files using TestFramework.productTfm
T-Gro Jan 29, 2026
c89bb91
Fix remaining hardcoded net10.0 in test files
T-Gro Jan 29, 2026
fa75962
Fix remaining hardcoded net10.0 in test files
T-Gro Jan 29, 2026
a7057d9
Sprint 6: Update remaining test files to use centralized TFM
T-Gro Jan 29, 2026
7c556d4
Sprint 6: Update remaining test files to use centralized TFM
T-Gro Jan 29, 2026
5eda766
Centralize product TFM into eng/productTfm.txt
T-Gro Jan 29, 2026
03613ea
Centralize product TFM into eng/productTfm.txt
T-Gro Jan 29, 2026
8ec4781
Merge branch 'extract-tfm-logic' of https://github.com/dotnet/fsharp …
T-Gro Feb 2, 2026
49c054b
Remove .ralph directory
T-Gro Feb 2, 2026
af9ff0e
Centralize product TFM into eng/productTfm.txt
T-Gro Feb 2, 2026
a2f24d0
simplify productMajor and runningMajor logic for TP resolution
T-Gro Feb 2, 2026
11ce7a9
Merge branch 'extract-tfm-logic' of https://github.com/dotnet/fsharp …
T-Gro Feb 2, 2026
31600be
Fix buildproperties.fs generation for FSharp.Core and array yield syntax
T-Gro Feb 2, 2026
65ee604
Add release notes for PR #19251
T-Gro Feb 2, 2026
dbc7cee
Fix AheadOfTime tests: import Directory.Build.props for FSharpNetCore…
T-Gro Feb 2, 2026
f784577
Fix AheadOfTime tests: read productTfm.txt directly instead of import…
T-Gro Feb 2, 2026
c2d3708
Fix formatting in FxResolver.fs
T-Gro Feb 2, 2026
9e6a2dd
Fix regression tests: include productTfm.txt in UseLocalCompilerProps…
T-Gro Feb 2, 2026
cdd49be
Merge branch 'main' into extract-tfm-logic
T-Gro Feb 2, 2026
97383b8
Merge branch 'main' into extract-tfm-logic
T-Gro Feb 3, 2026
64f106f
Update FSharp.Compiler.Service.fsproj
T-Gro Feb 3, 2026
7295c8e
Merge branch 'main' into extract-tfm-logic
T-Gro Feb 4, 2026
337d2f5
Add eng/TargetFrameworks.props as MSBuild source of truth for product…
T-Gro Feb 5, 2026
e194b0f
Use FSharp.BuildProperties.fsProductTfm in TestFramework.fs
T-Gro Feb 5, 2026
c6b59c0
Migrate PowerShell scripts to use MSBuild --getProperty: for TFM
T-Gro Feb 5, 2026
f559f1f
Migrate eng/build.sh to use --getProperty for TFM
T-Gro Feb 5, 2026
38a6776
Migrate CMD scripts to use --getProperty for TFM
T-Gro Feb 5, 2026
17a0831
Update Azure Pipelines to use TargetFrameworks.props
T-Gro Feb 5, 2026
a360a8b
Delete productTfm.txt and update references to TargetFrameworks.props
T-Gro Feb 5, 2026
b2c89c9
Migrate MSBuild files to import TargetFrameworks.props instead of rea…
T-Gro Feb 5, 2026
b2a9266
Update eng/TargetFrameworks.props
T-Gro Feb 6, 2026
aa30373
Merge branch 'main' into extract-tfm-logic
T-Gro Feb 6, 2026
d8058b6
pass DotNetBuildSourceOnly to tfm extraction logic
T-Gro Feb 6, 2026
d536fbc
Delete buildtools/checkpackages/Version.txt
T-Gro Feb 6, 2026
e0b37fb
Deduped with FSharpNetCoreProductTargetFramework, kept only that
T-Gro Feb 6, 2026
a67e7e1
Merge branch 'extract-tfm-logic' of https://github.com/dotnet/fsharp …
T-Gro Feb 6, 2026
fdd49b2
Move NetCurrent back only to where product is built.
T-Gro Feb 6, 2026
123d911
Fix TFM resolution in build.sh: resolve after SDK init to avoid stdou…
T-Gro Feb 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<Project>

<!-- Import target frameworks from single source of truth -->
<Import Project="$(MSBuildThisFileDirectory)eng/TargetFrameworks.props" />

<PropertyGroup>
<PackageProjectUrl>https://github.com/dotnet/fsharp</PackageProjectUrl>
<RepositoryUrl>https://github.com/dotnet/fsharp</RepositoryUrl>
<LangVersion Condition="'$(FSharpLangVersion)' != ''">$(FSharpLangVersion)</LangVersion>
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<FSharpNetCoreProductDefaultTargetFramework>net10.0</FSharpNetCoreProductDefaultTargetFramework>
<IgnoreMibc Condition="'$(IgnoreMibc)' == ''">$(DotNetBuildSourceOnly)</IgnoreMibc>
<!-- When building the .NET product, there's no need to publish Windows PDBs. Any conversion to Windows PDBs will be done during staging, if necessary. -->
<PublishWindowsPdb Condition="'$(DotNetBuild)' == 'true'">false</PublishWindowsPdb>
Expand Down Expand Up @@ -57,34 +59,20 @@
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
<!-- Note, that default framework is used here (the one we use for development in the current cycle),
since it's a non-arcade and non-sourcebuild scenario -->
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductTargetFramework)/$(RuntimeIdentifier)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<DefineConstants>BUILDING_WITH_LKG;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'" />

<Import Project="FSharpBuild.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' == '' " />
<!-- To support source-build for the "next" version of .NET without forcing this repo to use it,
we can utilize arcade's $(NetCurrent) property, and set it ourselves in the arcade-less scenarios.
For FCS solution, we set it to one for current dev cycle.
When used with arcade, and inserting/building for net8 branches, it will set it to net8.0, for net9 branches to net9.0 and so on. -->
<Choose>
<!-- Once we move to OOP in VS, and major dependants of FCS will move to netcore (not netstandard),
we should also support $(NetPrevious) for all releases.
This will likely include FCS and FSharp.Core as well as shipped products.
Right now, it only covers products we ship (FSC and FSI), not NuGet packages. -->
<When Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(NetCurrent)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(FSharpNetCoreProductDefaultTargetFramework)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
</Otherwise>
</Choose>

<!-- Source-build override: Arcade SDK (imported above) provides $(NetCurrent).
Cannot live in eng/TargetFrameworks.props because it's imported before Arcade. -->
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<FSharpNetCoreProductTargetFramework>$(NetCurrent)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>

<!-- It's important we set TFM before this, since FSharpTests.Directory.Build.props uses it.
TODO(vlza): this build props looks outdated, since we only use $(FSharpTestCompilerVersion) in TP tests or cambridge suite (which we slowly want to migrate to xUnit).
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<!-- Note, that default framework is used here (the one we use for development in the current cycle),
since it's a non-arcade and non-sourcebuild scenario -->
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fsyacc.dll</FsYaccPath>
</PropertyGroup>

<ItemGroup Condition="'$(DesignTimeBuild)' == 'true'">
Expand Down
3 changes: 3 additions & 0 deletions FSharpBuild.Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<_BuildPropertyLines Include="module internal FSharp.BuildProperties" />
<_BuildPropertyLines Include="let fsProductVersion = &quot;$(FSPRODUCTVERSION)&quot;" />
<_BuildPropertyLines Include="let fsLanguageVersion = &quot;$(FSLANGUAGEVERSION)&quot;" />
<!-- Only include TFM properties for non-FSharp.Core projects (FSharp.Core is still defining the int type) -->
<_BuildPropertyLines Include="let fsProductTfm = &quot;$(FSharpNetCoreProductTargetFramework)&quot;" Condition="'$(MSBuildProjectName)' != 'FSharp.Core'" />
<_BuildPropertyLines Include="let fsProductTfmMajorVersion : int = $(FSharpNetCoreProductMajorVersion)" Condition="'$(MSBuildProjectName)' != 'FSharp.Core'" />
</ItemGroup>

<MakeDir
Expand Down
12 changes: 9 additions & 3 deletions UseLocalCompiler.Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<Project>
<!-- Import target frameworks from single source of truth.
For regression tests: TargetFrameworks.props is co-located with this props file.
For local usage: use eng/TargetFrameworks.props relative to this file's directory. -->
<Import Project="$(MSBuildThisFileDirectory)TargetFrameworks.props" Condition="Exists('$(MSBuildThisFileDirectory)TargetFrameworks.props')" />
<Import Project="$(MSBuildThisFileDirectory)eng/TargetFrameworks.props" Condition="!Exists('$(MSBuildThisFileDirectory)TargetFrameworks.props')" />

<PropertyGroup>
<LoadLocalFSharpBuild Condition="'$(LoadLocalFSharpBuild)' == ''">False</LoadLocalFSharpBuild>

Expand All @@ -11,8 +17,8 @@
<FscToolPath Condition="'$(FscToolPath)' == ''">$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))</FscToolPath>
<FscToolExe Condition="'$(FscToolExe)' == ''">$([System.IO.Path]::GetFileName($(DOTNET_HOST_PATH)))</FscToolExe>

<DotnetFscCompilerPath>$(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/net10.0/fsc.dll</DotnetFscCompilerPath>
<Fsc_DotNET_DotnetFscCompilerPath>$(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/net10.0/fsc.dll</Fsc_DotNET_DotnetFscCompilerPath>
<DotnetFscCompilerPath>$(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/$(FSharpNetCoreProductTargetFramework)/fsc.dll</DotnetFscCompilerPath>
<Fsc_DotNET_DotnetFscCompilerPath>$(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/$(FSharpNetCoreProductTargetFramework)/fsc.dll</Fsc_DotNET_DotnetFscCompilerPath>

<FSharpPreferNetFrameworkTools>False</FSharpPreferNetFrameworkTools>
<FSharpPrefer64BitTools>True</FSharpPrefer64BitTools>
Expand All @@ -25,7 +31,7 @@
See: https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FSharpTargetsShim.targets
-->
<PropertyGroup Condition="'$(LoadLocalFSharpBuild)' == 'True'">
<LocalFSharpBuildBinPath>$(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/net10.0</LocalFSharpBuildBinPath>
<LocalFSharpBuildBinPath>$(LocalFSharpCompilerPath)/artifacts/bin/fsc/$(LocalFSharpCompilerConfiguration)/$(FSharpNetCoreProductTargetFramework)</LocalFSharpBuildBinPath>
<FSharpBuildAssemblyFile>$(LocalFSharpBuildBinPath)/FSharp.Build.dll</FSharpBuildAssemblyFile>
<FSharpTargetsPath>$(LocalFSharpBuildBinPath)/Microsoft.FSharp.Targets</FSharpTargetsPath>
<FSharpPropsShim>$(LocalFSharpBuildBinPath)/Microsoft.FSharp.NetSdk.props</FSharpPropsShim>
Expand Down
12 changes: 11 additions & 1 deletion azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,20 @@ stages:
publishLocation: pipeline
condition: succeeded()

- pwsh: |
# Stage UseLocalCompiler props and TargetFrameworks.props together
$stagingDir = "$(Build.SourcesDirectory)/UseLocalCompilerPropsStaging"
New-Item -ItemType Directory -Force -Path $stagingDir | Out-Null
Copy-Item "$(Build.SourcesDirectory)/UseLocalCompiler.Directory.Build.props" -Destination $stagingDir
Copy-Item "$(Build.SourcesDirectory)/eng/TargetFrameworks.props" -Destination $stagingDir
Write-Host "Staged files for UseLocalCompilerProps artifact:"
Get-ChildItem $stagingDir -Name
displayName: Stage UseLocalCompiler props files

- task: PublishPipelineArtifact@1
displayName: Publish UseLocalCompiler props file for Regression Tests
inputs:
targetPath: '$(Build.SourcesDirectory)/UseLocalCompiler.Directory.Build.props'
targetPath: '$(Build.SourcesDirectory)/UseLocalCompilerPropsStaging'
artifactName: 'UseLocalCompilerProps'
publishLocation: pipeline
condition: succeeded()
Expand Down
3 changes: 3 additions & 0 deletions buildtools/checkpackages/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project>
<!-- Import target frameworks from single source of truth -->
<Import Project="$(MSBuildThisFileDirectory)..\..\eng\TargetFrameworks.props" />

<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<CachePath>$(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid())</CachePath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$(MSBuildProjectDirectory)\..\..\eng\Versions.props" />

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<CachePath>$(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid())</CachePath>
<OutputPath>$(CachePath)\bin</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion buildtools/checkpackages/FSharp.Core_notshipped.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$(MSBuildProjectDirectory)\..\..\eng\Versions.props" />

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/10.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

* Parallel compilation features: ref resolution, graph based checking, ILXGen and optimization enabled by default ([PR #18998](https://github.com/dotnet/fsharp/pull/18998))
* Make graph based type checking and parallel optimizations deterministic ([PR #19028](https://github.com/dotnet/fsharp/pull/19028))
* Centralize compiler's target framework moniker logic into a single source of truth. ([PR #19251](https://github.com/dotnet/fsharp/pull/19251))

### Breaking Changes

Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/10.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

### Changed

* Centralized product TFM (Target Framework Moniker) into MSBuild props file `eng/TargetFrameworks.props`. Changing the target framework now only requires editing one file, and it integrates with MSBuild's `--getProperty` for scripts.

### Breaking Changes
15 changes: 12 additions & 3 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ param (
# Options
[switch][Alias('proto')]$bootstrap,
[string]$bootstrapConfiguration = "Proto",
[string]$bootstrapTfm = "net10.0",
[string]$fsharpNetCoreProductTfm = "net10.0",
[string]$bootstrapTfm = "",
[string]$fsharpNetCoreProductTfm = "",
[switch][Alias('bl')]$binaryLog = $true,
[switch][Alias('nobl')]$excludeCIBinaryLog = $false,
[switch][Alias('nolog')]$noBinaryLog = $false,
Expand Down Expand Up @@ -82,7 +82,16 @@ $BuildCategory = ""
$BuildMessage = ""

$desktopTargetFramework = "net472"
$coreclrTargetFramework = "net10.0"
# Read product TFM from centralized source of truth via MSBuild
$coreclrTargetFramework = (& $PSScriptRoot/common/dotnet.ps1 msbuild $PSScriptRoot/TargetFrameworks.props --getProperty:FSharpNetCoreProductTargetFramework).Trim()

# Set defaults for bootstrapTfm and fsharpNetCoreProductTfm if not provided
if ($bootstrapTfm -eq "") {
$bootstrapTfm = $coreclrTargetFramework
}
if ($fsharpNetCoreProductTfm -eq "") {
$fsharpNetCoreProductTfm = $coreclrTargetFramework
}

function Print-Usage() {
Write-Host "Common settings:"
Expand Down
20 changes: 20 additions & 0 deletions eng/TargetFrameworks.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>

<!--
This file defines the default target framework for F# .NET Core products.
It is the single source of truth for the product TFM.

Properties are set defensively (only if not already set) to allow:
- Environment variable overrides
- CLI property overrides (e.g., -p:FSharpNetCoreProductTargetFramework=net9.0)
-->

<PropertyGroup>
<!-- Default target framework for F# products - only set if not already provided -->
<FSharpNetCoreProductTargetFramework Condition="'$(FSharpNetCoreProductTargetFramework)' == ''">net10.0</FSharpNetCoreProductTargetFramework>

<!-- Derive major version by stripping 'net' prefix and '.0' suffix (e.g., net10.0 -> 10) -->
<FSharpNetCoreProductMajorVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1'))</FSharpNetCoreProductMajorVersion>
</PropertyGroup>

</Project>
4 changes: 3 additions & 1 deletion eng/build-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ $nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { $false }
$bootstrapDir = if (Test-Path variable:bootstrapDir) { $bootstrapDir } else { "" }
$bootstrapConfiguration = if (Test-Path variable:bootstrapConfiguration) { $bootstrapConfiguration } else { "Proto" }
$bootstrapTfm = if (Test-Path variable:bootstrapTfm) { $bootstrapTfm } else { "net472" }
$fsharpNetCoreProductTfm = if (Test-Path variable:fsharpNetCoreProductTfm) { $fsharpNetCoreProductTfm } else { "net10.0" }
# Read product TFM from centralized source of truth via MSBuild
$fsharpNetCoreProductTfmDefault = (& $PSScriptRoot/common/dotnet.ps1 msbuild $PSScriptRoot/TargetFrameworks.props --getProperty:FSharpNetCoreProductTargetFramework).Trim()
$fsharpNetCoreProductTfm = if (Test-Path variable:fsharpNetCoreProductTfm) { $fsharpNetCoreProductTfm } else { $fsharpNetCoreProductTfmDefault }
$properties = if (Test-Path variable:properties) { $properties } else { @() }

function GetProjectOutputBinary([string]$fileName, [string]$projectName = "", [string]$configuration = $script:configuration, [string]$tfm = "net472", [string]$rid = "", [bool]$published = $false) {
Expand Down
9 changes: 8 additions & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ properties=""
docker=false
args=""

tfm="net10.0" # This needs to be changed every time it's bumped by arcade/us.
# TFM will be resolved after InitializeDotNetCli ensures the SDK is available.
# Can be overridden via --tfm argument.
tfm=""

BuildCategory=""
BuildMessage=""
Expand Down Expand Up @@ -352,6 +354,11 @@ trap TrapAndReportError EXIT

InitializeDotNetCli $restore

# Resolve product TFM from centralized source of truth if not overridden via --tfm
if [[ "$tfm" == "" ]]; then
tfm=$("$DOTNET_INSTALL_DIR/dotnet" msbuild "$scriptroot/TargetFrameworks.props" -getProperty:FSharpNetCoreProductTargetFramework 2>/dev/null | tr -d '[:space:]')
fi

BuildSolution

if [[ "$test_core_clr" == true ]]; then
Expand Down
3 changes: 2 additions & 1 deletion eng/templates/regression-test-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ jobs:
dotnet msbuild -version
Write-Host ""
Write-Host "F# Compiler artifacts available:"
Get-ChildItem "$(Pipeline.Workspace)/FSharpCompiler/bin/fsc/Release/net10.0" -Name -ErrorAction SilentlyContinue
$productTfm = (dotnet msbuild "$(Pipeline.Workspace)/Props/TargetFrameworks.props" --getProperty:FSharpNetCoreProductTargetFramework).Trim()
Get-ChildItem "$(Pipeline.Workspace)/FSharpCompiler/bin/fsc/Release/$productTfm" -Name -ErrorAction SilentlyContinue
Write-Host ""
Write-Host "F# Core available:"
if (Test-Path "$(Pipeline.Workspace)/FSharpCompiler/bin/FSharp.Core/Release/netstandard2.0/FSharp.Core.dll") {
Expand Down
3 changes: 2 additions & 1 deletion eng/test-determinism.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ try {

$script:bootstrap = $true
$script:bootstrapConfiguration = "Proto"
$script:fsharpNetCoreProductTfm = "net10.0"
# Read product TFM from centralized source of truth via MSBuild
$script:fsharpNetCoreProductTfm = (& $PSScriptRoot/common/dotnet.ps1 msbuild $PSScriptRoot/TargetFrameworks.props --getProperty:FSharpNetCoreProductTargetFramework).Trim()
$script:bootstrapTfm = $script:fsharpNetCoreProductTfm

$bootstrapDir = Make-BootstrapBuild
Expand Down
6 changes: 5 additions & 1 deletion src/Compiler/Driver/FxResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ type internal FxResolver

match runningTfmOpt with
| Some tfm -> tfm
| _ -> if isRunningOnCoreClr then "net11.0" else "net472"
| _ ->
if isRunningOnCoreClr then
FSharp.BuildProperties.fsProductTfm
else
"net472"

let trySdkRefsPackDirectory =
lazy
Expand Down
6 changes: 5 additions & 1 deletion src/Compiler/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -572,17 +572,21 @@
</ItemGroup>

<ItemGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<!-- We are setting TFM explicitly here, since we are only using fslexyacc's dlls in msbuild -->
<!-- We are setting TFM explicitly here, since we are only using fslexyacc's dlls in msbuild.
GlobalPropertiesToRemove prevents duplicate builds when FCS builds for multiple TFMs in parallel. -->
<ProjectReference Include="$(RepoRoot)\buildtools\fslex\fslex.fsproj" ReferenceOutputAssembly="False">
<SetTargetFramework>TargetFramework=$(FSharpNetCoreProductTargetFramework)</SetTargetFramework>
<GlobalPropertiesToRemove>TargetFramework</GlobalPropertiesToRemove>
<ExcludeAssets>compile</ExcludeAssets>
</ProjectReference>
<ProjectReference Include="$(RepoRoot)\buildtools\fsyacc\fsyacc.fsproj" ReferenceOutputAssembly="False">
<SetTargetFramework>TargetFramework=$(FSharpNetCoreProductTargetFramework)</SetTargetFramework>
<GlobalPropertiesToRemove>TargetFramework</GlobalPropertiesToRemove>
<ExcludeAssets>compile</ExcludeAssets>
</ProjectReference>
<ProjectReference Include="$(RepoRoot)\buildtools\AssemblyCheck\AssemblyCheck.fsproj" ReferenceOutputAssembly="False">
<SetTargetFramework>TargetFramework=$(FSharpNetCoreProductTargetFramework)</SetTargetFramework>
<GlobalPropertiesToRemove>TargetFramework</GlobalPropertiesToRemove>
<ExcludeAssets>compile</ExcludeAssets>
</ProjectReference>
</ItemGroup>
Expand Down
28 changes: 14 additions & 14 deletions src/Compiler/Facilities/CompilerLocation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@ module internal FSharpEnvironment =
"netstandard2.0"
|]
elif typeof<obj>.Assembly.GetName().Name = "System.Private.CoreLib" then
let productMajor = FSharp.BuildProperties.fsProductTfmMajorVersion
let runningMajor = Environment.Version.Major

[|
"net11.0"
"net10.0"
"net9.0"
"net8.0"
"net7.0"
"net6.0"
"net5.0"
"netcoreapp3.1"
"netcoreapp3.0"
"netstandard2.1"
"netcoreapp2.2"
"netcoreapp2.1"
"netcoreapp2.0"
"netstandard2.0"
for v in max productMajor runningMajor .. -1 .. 5 -> $"net{v}.0"
yield!
[|
"netcoreapp3.1"
"netcoreapp3.0"
"netstandard2.1"
"netcoreapp2.2"
"netcoreapp2.1"
"netcoreapp2.0"
"netstandard2.0"
|]
|]
else
Debug.Assert(false, "Couldn't determine runtime tooling context, assuming it supports at least .NET Standard 2.0")
Expand Down
Loading
Loading