Use correct TFM for source build when OfficialBuildId isn't set #18397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to dotnet/source-build#4855
When building fsharp in source build without having
OfficialBuildId
set, it ends up using the default TFM ofnet9.0
for the FSharp.Compiler.Service project. This causes a failure because source build uses the latest TFM,net10.0
currently:System.Collections.Immutable 10.0.0-preview.2.25160.1 doesn't support net9.0 and has not been tested with it. Consider upgrading your TargetFramework to net10.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.
This is caused by an incorrect property being used for setting
TargetFrameworks
whenOfficialBuildId
isn't set for the FSharp.Compiler.Service project. It's configured to useFSharpNetCoreProductDefaultTargetFramework
, which is always hardcoded:fsharp/Directory.Build.props
Line 9 in 3259edf
Instead, it should use
FSharpNetCoreProductTargetFramework
, which will be set toFSharpNetCoreProductDefaultTargetFramework
unless source build is being used when it'll be set toNetCurrent
:fsharp/Directory.Build.props
Lines 75 to 90 in 3259edf