Skip to content

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Jul 28, 2025

Instead of EnableAOTAnalyzer. This is necessary for the metadata added in #118008 to make it into our libraries.

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 28, 2025
@sbomer sbomer force-pushed the isAotCompatible branch from 42b7725 to 1a4b5c6 Compare July 28, 2025 23:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes AOT (Ahead-of-Time) compilation configuration in .NET libraries by replacing the deprecated EnableAOTAnalyzer property with the new IsAotCompatible property. This change ensures that metadata from PR #118008 will be properly included in the libraries.

Key Changes:

  • Replaces EnableAOTAnalyzer with IsAotCompatible across all library project files
  • Updates the default configuration in Directory.Build.props to use the new property
  • Maintains the same AOT compatibility settings (true/false values) for each library

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/libraries/Directory.Build.props Updates default AOT configuration to use IsAotCompatible instead of EnableAOTAnalyzer
src/libraries/Microsoft.CSharp/src/Microsoft.CSharp.csproj Changes EnableAOTAnalyzer=true to IsAotCompatible=true
src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.ComponentModel.Composition/src/System.ComponentModel.Composition.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Composition.Hosting/src/System.Composition.Hosting.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Composition.Runtime/src/System.Composition.Runtime.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Data.OleDb/src/System.Data.OleDb.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Reflection.MetadataLoadContext/src/System.Reflection.MetadataLoadContext.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Runtime.Serialization.Schema/src/System.Runtime.Serialization.Schema.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false
src/libraries/System.Windows.Extensions/src/System.Windows.Extensions.csproj Changes EnableAOTAnalyzer=false to IsAotCompatible=false

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code path need to get updated?

public const string EnableAotAnalyzer = nameof(EnableAotAnalyzer);

@sbomer
Copy link
Member Author

sbomer commented Jul 29, 2025

Does this code path need to get updated?

No, the analyzer still should look for EnableAotAnalyzer. Setting IsAotCompatible pulls in some MSBuild targets that set this:

<EnableAotAnalyzer Condition="'$(EnableAotAnalyzer)' == ''">false</EnableAotAnalyzer>

EnableAotAnalyzer can be used to disable the analyzer while still getting logic from those targets, but IsAotCompatible (for libraries) and PublishAot (for apps) remain the recommended ways to enable this tooling.

edit: sorry, linked the wrong targets. They are actually built into the SDK:

https://github.com/dotnet/sdk/blob/1b4646d2244ffa462e59f10bc752f2ff6f94b569/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets#L84-L97

@pavelsavara
Copy link
Member

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sbomer sbomer deleted the isAotCompatible branch August 7, 2025 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants