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

Document IsAotCompatible MSBuild property #35722

Closed
1 of 3 tasks
eerhardt opened this issue Jun 8, 2023 · 5 comments · Fixed by #35755
Closed
1 of 3 tasks

Document IsAotCompatible MSBuild property #35722

eerhardt opened this issue Jun 8, 2023 · 5 comments · Fixed by #35755
Assignees
Labels
doc-idea Indicates issues that are suggestions for new topics [org][type][category] dotnet-fundamentals/svc okr-freshness OKR: Freshness of content Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@eerhardt
Copy link
Member

eerhardt commented Jun 8, 2023

Issue description

dotnet/sdk#31766 added support for a new MSBuild property to set in libraries: <IsAotCompatible>true</IsAotCompatible>. Setting this property defaults the following properties:

  • IsTrimmable=true
  • EnableTrimAnalyzer=true
  • EnableSingleFileAnalyzer=true
  • EnableAotAnalyzer=true

If a library wants to be "Native AOT compatible", it can set this one property to enable all the Roslyn analyzers to ensure the library is compatible.

We should add documentation for this property in our docs site. It is similar to IsTrimmable, but goes further for AOT. The only docs I could find for IsTrimmable is https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming#enable-project-specific-trimming. Potentially we could document IsAotCompatible in the sibling section at https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/.

Target framework

  • .NET Core - only the v8.0+ .NET SDK respects this property
  • .NET Framework
  • .NET Standard

@DamianEdwards @IEvangelist @agocke


Associated WorkItem - 98749

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Jun 8, 2023
@IEvangelist IEvangelist self-assigned this Jun 8, 2023
@IEvangelist IEvangelist added doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 okr-freshness OKR: Freshness of content 🗺️ reQUEST Triggers an issue to be imported into Quest. and removed Pri3 labels Jun 8, 2023
@dotnet-bot dotnet-bot removed the ⌚ Not Triaged Not triaged label Jun 8, 2023
@IEvangelist IEvangelist moved this from 🔖 Ready to 🏗 In progress in dotnet/docs June 2023 sprint Jun 8, 2023
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Jun 9, 2023
@ghost ghost added the in-pr This issue will be closed (fixed) by an active pull request. label Jun 12, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in dotnet/docs June 2023 sprint Jun 12, 2023
@ghost ghost removed the in-pr This issue will be closed (fixed) by an active pull request. label Jun 12, 2023
@voroninp
Copy link
Contributor

voroninp commented Dec 1, 2023

When can library be trimmable but not AOT compatible?

@eerhardt
Copy link
Member Author

eerhardt commented Dec 1, 2023

When can library be trimmable but not AOT vompatible?

When it requires dynamically generated code. For example, when it uses IL Ref Emit. The library may only need trim analyzers, and not care about the Aot analyzers.

@karthikpn
Copy link

Is there going to support for NET Standard in future?

@eerhardt
Copy link
Member Author

eerhardt commented Mar 7, 2024

Is there going to support for NET Standard in future?

There is no planned support for .NET Standard with trimming or AOT properties/attributes. See https://devblogs.microsoft.com/dotnet/creating-aot-compatible-libraries/#targetframeworks for more information on this topic.

@michael-hawker
Copy link

Wanted to say I found it confusing the guidance for library authors on the IsAotCompatible flag was mixed in to the main article for app developers on AOT.

I think there should be a main separate page oriented towards library developers and enabling AOT in their packages, that also goes through how to resolve those warnings; akin to this blog: https://devblogs.microsoft.com/dotnet/creating-aot-compatible-libraries/

This is a hard subject for folks to parse, and the main guidance being in an article geared to apps means it's going to get lost as it doesn't seem relevant at first glance as it's about apps. Even knowing the property to search for, the top two results don't seem relevant:

Image

Seems like the blog and the following document are the higher hits when searching more broadly ".NET Library AOT compatibility": https://learn.microsoft.com/dotnet/core/deploying/native-aot/libraries (which has very little information)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-idea Indicates issues that are suggestions for new topics [org][type][category] dotnet-fundamentals/svc okr-freshness OKR: Freshness of content Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants