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

Unexpected NETSDK1210 after removing TFM #40870

Open
MihaZupan opened this issue May 14, 2024 · 0 comments
Open

Unexpected NETSDK1210 after removing TFM #40870

MihaZupan opened this issue May 14, 2024 · 0 comments
Labels
Area-NativeAOT Native AOT compilation Area-NetSDK

Comments

@MihaZupan
Copy link
Member

Describe the bug

When using IsAotCompatible in a library that targets multiple TFMs, the NETSDK1210 warning appears after removing a TFM.

IsAotCompatible and EnableAotAnalyzer are not supported for the target framework. Consider multi-targeting to a supported framework to enable ahead-of-time compilation analysis, and set IsAotCompatible only for the supported frameworks. For example:
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>

To Reproduce

  • Create an empty class library project
  • Set the TFMs and mark as AOT compatible
    <TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
    <IsAotCompatible>true</IsAotCompatible>
  • Build and observe no warnings
  • Remove the 7.0 target: <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
  • Build and observe a NETSDK1210 warning

Further technical details

  • SDK 9.0.100-preview.3.24204.13

While we can workaround the issue as hinted in the warning message, is it expected that this would show up after removing the 7.0 TFM, even though you still have 8.0?

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels May 14, 2024
@marcpopMSFT marcpopMSFT added Area-NativeAOT Native AOT compilation and removed untriaged Request triage from a team member labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NativeAOT Native AOT compilation Area-NetSDK
Projects
None yet
Development

No branches or pull requests

2 participants