Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct TFM for source build when OfficialBuildId isn't set #18397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mthalman
Copy link
Member

Related to dotnet/source-build#4855

When building fsharp in source build without having OfficialBuildId set, it ends up using the default TFM of net9.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 when OfficialBuildId isn't set for the FSharp.Compiler.Service project. It's configured to use FSharpNetCoreProductDefaultTargetFramework, which is always hardcoded:

<FSharpNetCoreProductDefaultTargetFramework>net9.0</FSharpNetCoreProductDefaultTargetFramework>

Instead, it should use FSharpNetCoreProductTargetFramework, which will be set to FSharpNetCoreProductDefaultTargetFramework unless source build is being used when it'll be set to NetCurrent:

<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' AND '$(DotNetBuildOrchestrator)' == 'true'">
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(NetCurrent)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(FSharpNetCoreProductDefaultTargetFramework)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
</Otherwise>
</Choose>

@mthalman mthalman requested a review from a team as a code owner March 20, 2025 19:42
Copy link
Contributor

github-actions bot commented Mar 20, 2025

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@mthalman mthalman added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Mar 20, 2025
@T-Gro T-Gro enabled auto-merge (squash) March 21, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

2 participants