Blame SOURCES/installer-14792-mono.patch

c51fa4
Please note that the paths in this patch have been manually modified so
c51fa4
we can apply it against an already-built tarball. 
c51fa4
c51fa4
From 9a7d07ab5a163b75a7b82cf8883d32553f34dcdb Mon Sep 17 00:00:00 2001
c51fa4
From: Tom Deseyn <tom.deseyn@gmail.com>
c51fa4
Date: Wed, 19 Oct 2022 15:21:40 +0200
c51fa4
Subject: [PATCH] Enabled source-building with mono runtime on any
c51fa4
 architecture.
c51fa4
c51fa4
Adds an argument to the top-level build script to use the mono
c51fa4
runtime, and sets the flags needed for the different repos
c51fa4
to work with mono.
c51fa4
---
c51fa4
 eng/SourceBuild.props                         |  1 +
c51fa4
 .../tarball/content/Directory.Build.props     |  5 ++
c51fa4
 src/SourceBuild/tarball/content/build.sh      |  4 ++
c51fa4
 .../content/repos/Directory.Build.props       |  1 +
c51fa4
 ...d-support-building-with-mono-runtime.patch | 24 +++++++++
c51fa4
 ...d-support-building-with-mono-runtime.patch | 24 +++++++++
c51fa4
 ...d-support-building-with-mono-runtime.patch | 51 +++++++++++++++++++
c51fa4
 7 files changed, 110 insertions(+)
c51fa4
 create mode 100644 src/SourceBuild/tarball/patches/aspnetcore/0002-source-build-support-building-with-mono-runtime.patch
c51fa4
 create mode 100644 src/SourceBuild/tarball/patches/runtime/0001-source-build-support-building-with-mono-runtime.patch
c51fa4
 create mode 100644 src/SourceBuild/tarball/patches/sdk/0001-source-build-support-building-with-mono-runtime.patch
c51fa4
c51fa4
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
c51fa4
index a2831d57455..9ebca97ff90 100644
c51fa4
--- a/src/installer/eng/SourceBuild.props
c51fa4
+++ b/src/installer/eng/SourceBuild.props
c51fa4
@@ -11,6 +11,7 @@
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:IncludeNuGetPackageArchive=false</InnerBuildArgs>
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:IncludeAdditionalSharedFrameworks=false</InnerBuildArgs>
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:IncludeSharedFrameworksForBackwardsCompatibilityTests=false</InnerBuildArgs>
c51fa4
+      <InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:DISABLE_CROSSGEN=true</InnerBuildArgs>
c51fa4
     </PropertyGroup>
c51fa4
   </Target>
c51fa4
 
c51fa4
diff --git a/Directory.Build.props b/Directory.Build.props
c51fa4
index 860785575f7..982fb7f0725 100644
c51fa4
--- a/Directory.Build.props
c51fa4
+++ b/Directory.Build.props
c51fa4
@@ -24,6 +24,11 @@
c51fa4
 
c51fa4
     <UseStableVersions Condition="'$(UseStableVersions)' == ''">false</UseStableVersions>
c51fa4
 
c51fa4
+    <SourceBuildUseMonoRuntime>false</SourceBuildUseMonoRuntime>
c51fa4
+    
c51fa4
+    <SourceBuildUseMonoRuntime Condition="'$(BuildArchitecture)' == 's390x'">true</SourceBuildUseMonoRuntime>
c51fa4
+    <SourceBuildUseMonoRuntime Condition="'$(BuildArchitecture)' == 'ppc64le'">true</SourceBuildUseMonoRuntime>
c51fa4
+
c51fa4
     
c51fa4
          or portable SDK.  The PortableBuild flag is only set in runtime-portable.proj and should
c51fa4
          no longer be passed in.  -->
c51fa4
diff --git a/build.sh b/build.sh
c51fa4
index e899d2f808c..17699c78cb7 100755
c51fa4
--- a/build.sh
c51fa4
+++ b/build.sh
c51fa4
@@ -11,6 +11,7 @@ usage() {
c51fa4
     echo "  --run-smoke-test                   don't build; run smoke tests"
c51fa4
     echo "  --with-packages <dir>              use the specified directory of previously-built packages"
c51fa4
     echo "  --with-sdk <dir>                   use the SDK in the specified directory for bootstrapping"
c51fa4
+    echo "  --use-mono-runtime                 output uses the mono runtime"
c51fa4
     echo "use -- to send the remaining arguments to MSBuild"
c51fa4
     echo ""
c51fa4
 }
c51fa4
@@ -65,6 +66,9 @@ while :; do
c51fa4
             fi
c51fa4
             shift
c51fa4
             ;;
c51fa4
+        --use-mono-runtime)
c51fa4
+            MSBUILD_ARGUMENTS+=( "/p:SourceBuildUseMonoRuntime=true" )
c51fa4
+            ;;
c51fa4
         --)
c51fa4
             shift
c51fa4
             echo "Detected '--': passing remaining parameters '$@' as build.sh arguments."
c51fa4
diff --git a/repos/Directory.Build.props b/repos/Directory.Build.props
c51fa4
index e4e3060af7f..04ab89d11dc 100644
c51fa4
--- a/repos/Directory.Build.props
c51fa4
+++ b/repos/Directory.Build.props
c51fa4
@@ -143,6 +143,7 @@
c51fa4
     <StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:AdditionalSourceBuiltNupkgCacheDir="$(SourceBuiltPackagesPath)"</StandardSourceBuildArgs>
c51fa4
     <StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:ReferencePackageNupkgCacheDir="$(ReferencePackagesDir)"</StandardSourceBuildArgs>
c51fa4
     <StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:PreviouslySourceBuiltNupkgCacheDir="$(PrebuiltSourceBuiltPackagesPath)"</StandardSourceBuildArgs>
c51fa4
+    <StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:SourceBuildUseMonoRuntime=$(SourceBuildUseMonoRuntime)</StandardSourceBuildArgs>
c51fa4
 
c51fa4
     <StandardSourceBuildCommand>$(ProjectDirectory)\build$(ShellExtension)</StandardSourceBuildCommand>
c51fa4
   </PropertyGroup>
c51fa4
diff --git a/src/aspnetcore/eng/SourceBuild.props b/src/aspnetcore/eng/SourceBuild.props
c51fa4
index 32108e1f..3dfbd5ef 100644
c51fa4
--- a/src/aspnetcore/eng/SourceBuild.props
c51fa4
+++ b/src/aspnetcore/eng/SourceBuild.props
c51fa4
@@ -55,6 +55,7 @@
c51fa4
 
c51fa4
     <PropertyGroup>
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:SourceBuildRuntimeIdentifier=$(TargetRuntimeIdentifier)</InnerBuildArgs>
c51fa4
+      <InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:CrossgenOutput=false</InnerBuildArgs>
c51fa4
     </PropertyGroup>
c51fa4
   </Target>
c51fa4
 
c51fa4
diff --git a/src/runtime/eng/SourceBuild.props b/src/runtime/eng/SourceBuild.props
c51fa4
index c197d8afd..55c1c1d22 100644
c51fa4
--- a/src/runtime/eng/SourceBuild.props
c51fa4
+++ b/src/runtime/eng/SourceBuild.props
c51fa4
@@ -41,6 +41,7 @@
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:EnableNgenOptimization=false</InnerBuildArgs>
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:EnablePackageValidation=false</InnerBuildArgs>
90fd5e
       <InnerBuildArgs>$(InnerBuildArgs) /p:DisableSourceLink=false</InnerBuildArgs>
c51fa4
+      <InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:PrimaryRuntimeFlavor=Mono /p:RuntimeFlavor=Mono</InnerBuildArgs>
c51fa4
     </PropertyGroup>
c51fa4
   </Target>
c51fa4
 
c51fa4
diff --git a/src/sdk/eng/SourceBuild.props b/src/sdk/eng/SourceBuild.props
c51fa4
index 61b9a913708..2107a718419 100644
c51fa4
--- a/src/sdk/eng/SourceBuild.props
c51fa4
+++ b/src/sdk/eng/SourceBuild.props
c51fa4
@@ -8,6 +8,7 @@
c51fa4
     <PropertyGroup>
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\source-build.slnf"</InnerBuildArgs>
c51fa4
       <InnerBuildArgs>$(InnerBuildArgs) /p:UseSharedCompilation=false</InnerBuildArgs>
c51fa4
+      <InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:NativeAotSupported=false</InnerBuildArgs>
c51fa4
     </PropertyGroup>
c51fa4
   </Target>
c51fa4
 
c51fa4
diff --git a/src/sdk/src/Layout/redist/targets/BundledSdks.targets b/src/sdk/src/Layout/redist/targets/BundledSdks.targets
c51fa4
index 6f8b0fc3b33..64638ef1cff 100644
c51fa4
--- a/src/sdk/src/Layout/redist/targets/BundledSdks.targets
c51fa4
+++ b/src/sdk/src/Layout/redist/targets/BundledSdks.targets
c51fa4
@@ -5,6 +5,6 @@
c51fa4
     <BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
c51fa4
     <BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
c51fa4
     <BundledSdk Include="Microsoft.NET.ILLink.Tasks" Version="$(MicrosoftNETILLinkTasksPackageVersion)" />
c51fa4
-    <BundledSdk Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerPackageVersion)" />
c51fa4
+    <BundledSdk Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerPackageVersion)" Condition="'$(NativeAotSupported)' != 'false'" />
c51fa4
   </ItemGroup>
c51fa4
 </Project>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/Strings.resx b/src/sdk/src/Tasks/Common/Resources/Strings.resx
c51fa4
index a347c736df5..426cb6aa96d 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/Strings.resx
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/Strings.resx
c51fa4
@@ -875,4 +875,8 @@ You may need to build the project on another operating system or architecture, o
90fd5e
     <value>NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported.</value>
90fd5e
     <comment>{StrBegin="NETSDK1192: "}</comment>
c51fa4
   </data>
c51fa4
+  <data name="AotNotSupported" xml:space="preserve">
c51fa4
+    <value>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</value>
c51fa4
+      <comment>{StrBegin="NETSDK1193: "}</comment>
c51fa4
+  </data>
c51fa4
 </root>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
c51fa4
index e477f7a489b..c75990f94e2 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.cs.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Sestavení nelze optimalizovat pro kompilaci s předstihem: nebyl nalezen platný balíček modulu runtime. Buď nastavte vlastnost PublishAot na hodnotu false, nebo při publikování použijte podporovaný identifikátor modulu runtime. Při cílení na .NET 7 nebo vyšší nezapomeňte obnovit balíčky s vlastností PublishAot nastavenou na hodnotu true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: Konfigurační soubor aplikace musí obsahovat kořenový element konfigurace.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.de.xlf
c51fa4
index d8cd9725269..2e427931dd1 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.de.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.de.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Assemblys können nicht für Ahead-of-time-Kompilierung optimiert werden: Es wurde kein gültiges Runtimepaket gefunden. Legen Sie entweder die PublishAot-Eigenschaft auf FALSE fest, oder verwenden Sie beim Veröffentlichen einen unterstützten Runtimebezeichner. Wenn Sie .NET 7 oder höher verwenden, stellen Sie sicher, dass Sie Pakete wiederherstellen, bei denen die PublishAot-Eigenschaft auf TRUE festgelegt ist.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: Die Anwendungskonfigurationsdatei muss das Stammkonfigurationselement enthalten.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.es.xlf
c51fa4
index 4c61e20b937..cb654c521fb 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.es.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.es.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: No se pueden optimizar los ensamblados para la compilación Ahead of time: no se ha encontrado un paquete en tiempo de ejecución válido. Establezca la propiedad PublishAot en false o use un identificador de tiempo de ejecución compatible al publicar. Cuando el destino sea .NET 7 o una versión posterior, asegúrese de restaurar los paquetes con la propiedad PublishAot establecida en true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: El archivo de configuración de la aplicación debe tener el elemento de configuración raíz.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
c51fa4
index dfbb0391549..a97af754880 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.fr.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Impossible d'optimiser les assemblys pour la compilation Ahead of time : un package d'exécution valide n'a pas été trouvé. Définissez la propriété PublishAot sur false ou utilisez un identificateur d'exécution pris en charge lors de la publication. Lorsque vous ciblez .NET 7 ou supérieur, assurez-vous de restaurer les packages avec la propriété PublishAot définie sur true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: Le fichier de configuration de l'application doit avoir un élément de configuration racine.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.it.xlf
c51fa4
index a768517271c..70fe2939526 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.it.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.it.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: non è possibile ottimizzare gli assembly per la compilazione Ahead Of Time perché non è stato trovato alcun pacchetto di runtime valido. Impostare la proprietà PublishAot su false oppure usare un identificatore di runtime supportato durante la pubblicazione. Quando si usa .NET 7 o versioni successive, assicurarsi di ripristinare i pacchetti con la proprietà PublishAot impostata su true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: il file di configurazione dell'applicazione deve avere un elemento di configurazione radice.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
c51fa4
index c3713a3bb6f..42ba79f1034 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ja.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Ahead Of Time コンパイル用にアセンブリを最適化できません: 有効なランタイム パッケージが見つかりませんでした。PublishAot プロパティを false に設定するか、公開時に、サポートされているランタイム識別子を使用してください。.NET 7 以降を対象とする場合は、必ず PublishAot プロパティを true に設定してパッケージを復元してください。</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: アプリケーション構成ファイルには、ルート構成要素が必要です。</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
c51fa4
index 86d77d024ad..f9695e37529 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ko.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Ahead of Time 컴파일을 위해 어셈블리를 최적화할 수 없습니다. 유효한 런타임 패키지를 찾을 수 없습니다. PublishAot 속성을 false로 설정하거나 게시할 때 지원되는 런타임 식별자를 사용하세요. .NET 7 이상을 대상으로 하는 경우 PublishAot 속성이 true로 설정된 패키지를 복원해야 합니다.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: 애플리케이션 구성 파일에는 루트 구성 요소가 있어야 합니다.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
c51fa4
index b954c4f64f5..0594cfc5bad 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pl.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Nie można zoptymalizować zestawów pod kątem kompilacji z wyprzedzeniem: nie znaleziono prawidłowego pakietu środowiska uruchomieniowego. Ustaw właściwość PublishAot na wartość false lub użyj obsługiwanego identyfikatora środowiska uruchomieniowego podczas publikowania. W przypadku określania wartości docelowej platformy .NET 7 lub nowszej należy przywrócić pakiety z właściwością PublishAot ustawioną na wartość true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: Plik konfiguracji aplikacji musi mieć główny element konfiguracji.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
c51fa4
index 4153425cfce..ae701f4dc3b 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Não é possível otimizar assemblies para compilação antecipada: um pacote de tempo de execução válido não foi encontrado. Defina a propriedade PublishAot como false ou use um identificador de tempo de execução com suporte ao publicar. Ao direcionar o .NET 7 ou superior, certifique-se de restaurar os pacotes com a propriedade PublishAot definida como true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: o arquivo de configuração do aplicativo deve ter um elemento de configuração raiz.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
c51fa4
index e66e13cd417..1780c0eb89b 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.ru.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: не удалось оптимизировать сборки для компиляции Ahead Of Time: не найден допустимый пакет среды выполнения. Задайте для свойства PublishAot значение false либо используйте поддерживаемый идентификатор среды выполнения при публикации. При выборе .NET 7 или более поздней версии в качестве цели восстановите пакеты со свойством PublishAot со значением true.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: В файле конфигурации приложения должен присутствовать корневой элемент конфигурации.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
c51fa4
index 4121fe024d6..d4ec2bbfea3 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.tr.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: Derlemeler, AOT derlemesi için iyileştirilemedi: geçerli bir çalışma zamanı paketi bulunamadı. PublishAot özelliğini false olarak ayarlayın veya yayımlarken desteklenen bir çalışma zamanı tanımlayıcısı kullanın. .NET 7 veya üzerini hedeflerken PublishAot özelliği true olarak ayarlanmış paketleri geri yüklediğinizden emin olun.</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: Uygulama yapılandırma dosyasının kök yapılandırma öğesi olmalıdır.</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
c51fa4
index 5bd5617ccba..77323667f98 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: 无法优化程序集以实现提前编译: 找不到有效的运行时包。将 PublishAot 属性设置为 false,或在发布时使用支持的运行时标识符。面向 .NET 7 或更高版本时,请确保还原将 PublishAot 属性设置为 true 的包。</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: 应用程序配置文件必须具有根配置元素。</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
c51fa4
index c2e6be8b9be..ae573c7ed8b 100644
c51fa4
--- a/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
c51fa4
+++ b/src/sdk/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
c51fa4
@@ -12,6 +12,11 @@
c51fa4
         <target state="translated">NETSDK1183: 無法為提前編譯最佳化組件: 找不到有效的執行階段套件。請將 PublishAot 屬性設為 false,或在發佈時使用支援的執行階段識別碼。以 .NET 7 或更高版本為目標時,請務必還原套件,將 PublishAot 屬性設為 true。</target>
c51fa4
         <note>{StrBegin="NETSDK1183: "}</note>
c51fa4
       </trans-unit>
c51fa4
+      <trans-unit id="AotNotSupported">
c51fa4
+        <source>NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</source>
c51fa4
+        <target state="new">NETSDK1193: The SDK does not support Ahead of time compilation. Set the PublishAot property to false.</target>
c51fa4
+        <note>{StrBegin="NETSDK1193: "}</note>
c51fa4
+      </trans-unit>
c51fa4
       <trans-unit id="AppConfigRequiresRootConfiguration">
c51fa4
         <source>NETSDK1070: The application configuration file must have root configuration element.</source>
c51fa4
         <target state="translated">NETSDK1070: 應用程式組態檔必須有根組態元素。</target>
c51fa4
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
c51fa4
index 84b21ee0dd8..72d10f518af 100644
c51fa4
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
c51fa4
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
c51fa4
@@ -178,6 +178,9 @@ Copyright (c) .NET Foundation. All rights reserved.
c51fa4
                 ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
c51fa4
                 FormatArguments="PublishAot"/>
c51fa4
 
c51fa4
+    
c51fa4
+                ResourceName="AotNotSupported" />
c51fa4
+
c51fa4
     
c51fa4
     
c51fa4
                  ResourceName="CannotUseSelfContainedWithoutAppHost" />
c51fa4
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props
c51fa4
index 73a182102d1..b7eee4dfe3d 100644
c51fa4
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props
c51fa4
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props
c51fa4
@@ -116,6 +116,8 @@ Copyright (c) .NET Foundation. All rights reserved.
c51fa4
     <MSBuildCopyContentTransitively Condition="'$(MSBuildCopyContentTransitively)' == ''">true</MSBuildCopyContentTransitively>
c51fa4
     <ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts Condition="'$(ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts)' == ''">true</ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts>
c51fa4
 
c51fa4
+    <PublishAotSupported>false</PublishAotSupported>
c51fa4
+    <PublishAotSupported Condition="Exists('$(MSBuildThisFileDirectory)../../Microsoft.DotNet.ILCompiler')">true</PublishAotSupported>
c51fa4
     
c51fa4
     
c51fa4
   </PropertyGroup>
c51fa4
@@ -151,7 +153,7 @@ Copyright (c) .NET Foundation. All rights reserved.
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.CSharp.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.VisualBasic.props" Condition="'$(MSBuildProjectExtension)' == '.vbproj'" />
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.FSharp.props" Condition="'$(MSBuildProjectExtension)' == '.fsproj'" />
c51fa4
-  <Import Project="Sdk.props" Sdk="Microsoft.DotNet.ILCompiler" />
c51fa4
+  <Import Project="Sdk.props" Sdk="Microsoft.DotNet.ILCompiler"  Condition="'$(PublishAotSupported)' == 'true'" />
c51fa4
   <Import Project="Sdk.props" Sdk="Microsoft.NET.ILLink.Tasks" />
c51fa4
 
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.PackTool.props" />
c51fa4
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
c51fa4
index 4311ec0ecea..1f80ab9ded0 100644
c51fa4
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
c51fa4
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
c51fa4
@@ -1175,7 +1175,7 @@ Copyright (c) .NET Foundation. All rights reserved.
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.CSharp.targets" Condition="'$(Language)' == 'C#'" />
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.VisualBasic.targets" Condition="'$(Language)' == 'VB'" />
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.FSharp.targets" Condition="'$(Language)' == 'F#'" />
c51fa4
-  <Import Project="$(ILCompilerTargetsPath)" Condition="'$(PublishAot)' == 'true'"/>
c51fa4
+  <Import Project="$(ILCompilerTargetsPath)" Condition="'$(PublishAot)' == 'true' and '$(PublishAotSupported)' == 'true'"/>
c51fa4
   <Import Project="$(ILLinkTargetsPath)" Condition="'$(Language)' != 'C++'" />
c51fa4
   <Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.Analyzers.targets" Condition="'$(Language)' == 'C#' or '$(Language)' == 'VB'" />
c51fa4
 
c51fa4
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
c51fa4
index a943e6615bf..8593957f3d6 100644
c51fa4
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
c51fa4
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
c51fa4
@@ -111,6 +111,8 @@ Copyright (c) .NET Foundation. All rights reserved.
c51fa4
                             '$(EnableCompressionInSingleFile)' == 'true' And
c51fa4
                             '$(SelfContained)' != 'true'"
c51fa4
                  ResourceName="CompressionInSingleFileRequiresSelfContained" />
c51fa4
+    
c51fa4
+                ResourceName="AotNotSupported" />
c51fa4
 
c51fa4
     
c51fa4
     
c51fa4
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
c51fa4
index 72d10f518af..84b21ee0dd8 100644
c51fa4
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
c51fa4
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets
c51fa4
@@ -178,9 +178,6 @@ Copyright (c) .NET Foundation. All rights reserved.
c51fa4
                 ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
c51fa4
                 FormatArguments="PublishAot"/>
c51fa4
 
c51fa4
-    
c51fa4
-                ResourceName="AotNotSupported" />
c51fa4
-
c51fa4
     
c51fa4
     
c51fa4
                  ResourceName="CannotUseSelfContainedWithoutAppHost" />