Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Target Name="_ComputeIlcCompileInputs"
Condition="'$(BuildingFrameworkLibrary)' != 'true'"
BeforeTargets="ComputeIlcCompileInputs"
DependsOnTargets="$(IlcDynamicBuildPropertyDependencies);_ComputeAssembliesToCompileToNative;_PrepareTrimConfiguration">
DependsOnTargets="$(IlcDynamicBuildPropertyDependencies);_ComputeAssembliesToCompileToNative;PrepareTrimConfiguration">

<ItemGroup>
<_IlcManagedInputAssemblies Include="@(ResolvedFileToPublish)" Condition="'%(ResolvedFileToPublish.PostprocessAssembly)' == 'true'" />
Expand All @@ -24,7 +24,7 @@
The SDK typically sequences this target in the publish pipeline as:
ComputeResolvedFilesToPublishList -> ILLink (when RunILLink is true) -> NativeCompile -> ...

This gives us a clean, explicit position after trim configuration (_PrepareTrimConfiguration),
This gives us a clean, explicit position after trim configuration (PrepareTrimConfiguration),
regardless of whether ILLink itself runs.
============================================================
-->
Expand Down Expand Up @@ -84,7 +84,7 @@
<UsingTask TaskName="ComputeManagedAssembliesToCompileToNative" AssemblyFile="$(IlcBuildTasksPath)" />
<Target Name="_ComputeAssembliesToCompileToNative"
DependsOnTargets="$(IlcDynamicBuildPropertyDependencies);_ComputeAssembliesToPostprocessOnPublish"
BeforeTargets="_PrepareTrimConfiguration">
BeforeTargets="PrepareTrimConfiguration">

<Warning Condition="Exists($(UserRuntimeConfig))" Text="The published project has a runtimeconfig.template.json that is not supported by PublishAot. Move the configuration to the project file using RuntimeHostConfigurationOption." />
<!-- Fail with descriptive error message for common mistake. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,24 @@ Copyright (c) .NET Foundation. All rights reserved.

<!--
============================================================
_PrepareTrimConfiguration
PrepareTrimConfiguration

Set up shared trim configuration properties and metadata on ResolvedFileToPublish.
This target is shared between ILLink and ILC (NativeAOT). It sets default values for
trim-related properties (TrimMode, TrimmerSingleWarn), populates TrimmerRootAssembly
and _TrimmerFeatureSettings, and applies TrimmerSingleWarn metadata to
ResolvedFileToPublish items for the intermediate assembly and project references.

This is a public extension point. Other targets may hook into it via
BeforeTargets="PrepareTrimConfiguration" to add RuntimeHostConfigurationOption items.
Only items with Trim="true" metadata will be included in _TrimmerFeatureSettings
for both ILLink and ILC.

Consumers that need trim metadata on ResolvedFileToPublish should depend on this target.
Metadata set here flows to ManagedAssemblyToLink via _ComputeManagedAssemblyToLink (which
depends on this target), since ComputeManagedAssemblies preserves metadata from its inputs.
-->
<Target Name="_PrepareTrimConfiguration"
<Target Name="PrepareTrimConfiguration"
DependsOnTargets="_ComputeAssembliesToPostprocessOnPublish">

Comment thread
sbomer marked this conversation as resolved.
<!-- Set up TrimMode. -->
Expand Down Expand Up @@ -335,7 +340,7 @@ Copyright (c) .NET Foundation. All rights reserved.
============================================================
-->
<UsingTask TaskName="ComputeManagedAssemblies" AssemblyFile="$(ILLinkTasksAssembly)" Condition="'$(ILLinkTasksAssembly)' != ''" TaskFactory="TaskHostFactory" />
<Target Name="_ComputeManagedAssemblyToLink" DependsOnTargets="_PrepareTrimConfiguration">
<Target Name="_ComputeManagedAssemblyToLink" DependsOnTargets="PrepareTrimConfiguration">

<!-- NB: There should not be non-managed assemblies in this list, but we still give the ILLink a chance to
further refine this list. It currently drops C++/CLI assemblies in ComputeManageAssemblies. -->
Expand Down
Loading