diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs b/src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs
index e7a36b556429..e35ead24aece 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs
@@ -23,6 +23,7 @@ public class RunReadyToRunCompiler : ToolTask
public bool ShowCompilerWarnings { get; set; }
public bool UseCrossgen2 { get; set; }
public string Crossgen2ExtraCommandLineArgs { get; set; }
+ public string Crossgen2CompositeExtraCommandLineArgs { get; set; }
public ITaskItem[] Crossgen2PgoFiles { get; set; }
public string Crossgen2ContainerFormat { get; set; }
@@ -362,6 +363,17 @@ private string GenerateCrossgen2ResponseFile()
}
}
+ // Arguments that are only valid for full composite builds (e.g. --strip-il-bodies).
+ // These arguments will not be applied to any assemblies that have been excluded from the composite image.
+ if (_createCompositeImage && !_partialCompile
+ && !string.IsNullOrEmpty(Crossgen2CompositeExtraCommandLineArgs))
+ {
+ foreach (string extraArg in Crossgen2CompositeExtraCommandLineArgs.Split([';'], StringSplitOptions.RemoveEmptyEntries))
+ {
+ result.AppendLine(extraArg);
+ }
+ }
+
if (_partialCompile)
{
result.AppendLine("--partial");
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets
index 8e39f25b7cd1..278ec5ea3493 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets
@@ -35,17 +35,26 @@ Copyright (c) .NET Foundation. All rights reserved.
false
false
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info
-
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info
- $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info
+ true
+ true
+ true
+ true
+ true
+
+ true
+ true
+ true
+ true
+ true
+
+ true
+ true
+ true
+ true
+ true
+
+ $(PublishReadyToRunCrossgen2ExtraArgs);--strip-inlining-info
+ $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info
@@ -469,6 +478,10 @@ Copyright (c) .NET Foundation. All rights reserved.
<_ReadyToRunNativeObjectOutputs Include="@(_ReadyToRunFilesToPublish->WithMetadataValue('RequiresNativeLink', 'true'))" />
<_ReadyToRunNativeObjectOutputs OutputPath="%(Identity)" />
+
+
+ $(PublishReadyToRunCrossgen2CompositeExtraArgs);--strip-il-bodies
+
@@ -505,6 +518,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Crossgen2PgoFiles="@(_ReadyToRunPgoFiles)"
Crossgen2ContainerFormat="$(PublishReadyToRunContainerFormat)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs)"
+ Crossgen2CompositeExtraCommandLineArgs="$(PublishReadyToRunCrossgen2CompositeExtraArgs)"
ImplementationAssemblyReferences="@(_ReadyToRunAssembliesToReference)"
ShowCompilerWarnings="$(PublishReadyToRunShowWarnings)"
CompilationEntry="@(_ReadyToRunCompileList)"