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

Merged
merged 2 commits into from
Mar 25, 2025

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
@T-Gro T-Gro merged commit fc6c4c9 into dotnet:main Mar 25, 2025
33 checks passed
T-Gro added a commit that referenced this pull request Mar 26, 2025
* Use correct TFM for source build when OfficialBuildId isn't set (#18397)

* Update dependencies coming from maintenance-packages (#18329)

* Update dependencies coming from maintenance-packages

* Remove temp feed

* Sort

* Push for real the changes this time

* Update to latest in nuget.org

* Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20250320.3

Microsoft.SourceBuild.Intermediate.source-build-reference-packages
 From Version 9.0.0-alpha.1.25163.3 -> To Version 9.0.0-alpha.1.25170.3

* Bring back conditions

* missing space

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Kevin Ransom (msft) <[email protected]>
Co-authored-by: Tomas Grosup <[email protected]>

---------

Co-authored-by: Matt Thalman <[email protected]>
Co-authored-by: Carlos Sánchez López <[email protected]>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Kevin Ransom (msft) <[email protected]>
Co-authored-by: Tomas Grosup <[email protected]>
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
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants