From 0e16879b407734544576ddfb1801b7cc00df79db Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Thu, 25 Aug 2022 08:37:22 -0700 Subject: [PATCH 1/5] Show a warning when an explicit package reference to ILCompiler is added --- .../Microsoft.DotNet.ILCompiler.SingleEntry.targets | 1 + src/coreclr/nativeaot/docs/compiling.md | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 0018c70f987796..1009d116866309 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -41,6 +41,7 @@ <_PackageReferenceExceptILCompiler Include="@(PackageReference)" Exclude="Microsoft.DotNet.ILCompiler" /> <_ILCompilerPackageReference Include="@(PackageReference)" Exclude="@(_PackageReferenceExceptILCompiler)" /> + @(_ILCompilerPackageReference->'%(Version)') diff --git a/src/coreclr/nativeaot/docs/compiling.md b/src/coreclr/nativeaot/docs/compiling.md index 1b4475a89362d3..4bfc64409dc44f 100644 --- a/src/coreclr/nativeaot/docs/compiling.md +++ b/src/coreclr/nativeaot/docs/compiling.md @@ -2,8 +2,7 @@ Please consult [documentation](https://docs.microsoft.com/dotnet/core/deploying/native-aot) for instructions how to compile and publish application. -The rest of this document covers advanced topics only. - +The rest of this document covers advanced topics only. Adding an explicit package references to 'Microsoft.DotNet.ILCompile' can generate warnings when publishing and is only supported on a narrow set of scenarios. When possible, use the SDK options to publish a native AOT application. ## Using daily builds @@ -34,7 +33,7 @@ or by adding the following element to the project file: ## Cross-architecture compilation -Native AOT toolchain allows targeting ARM64 on an x64 host and vice versa for both Windows and Linux. Cross-OS compilation, such as targeting Linux on a Windows host, is not supported. To target win-arm64 on a Windows x64 host, in addition to the `Microsoft.DotNet.ILCompiler` package reference, also add the `runtime.win-x64.Microsoft.DotNet.ILCompiler` package reference to get the x64-hosted compiler: +Native AOT toolchain allows targeting ARM64 on an x64 host and vice versa for both Windows and Linux and is now supported in the SDK. Cross-OS compilation, such as targeting Linux on a Windows host, is not supported. To target win-arm64 on a Windows x64 host on an advanced scenario where the SDK support is not sufficient, in addition to the `Microsoft.DotNet.ILCompiler` package reference, also add the `runtime.win-x64.Microsoft.DotNet.ILCompiler` package reference to get the x64-hosted compiler: ```xml ``` From c23072961e1d59e3cd4942344ddb505f631fbfe7 Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Fri, 26 Aug 2022 12:49:02 -0700 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Jan Kotas --- .../Microsoft.DotNet.ILCompiler.SingleEntry.targets | 2 +- src/coreclr/nativeaot/docs/compiling.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 1009d116866309..bdada2ed7f7932 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -41,7 +41,7 @@ <_PackageReferenceExceptILCompiler Include="@(PackageReference)" Exclude="Microsoft.DotNet.ILCompiler" /> <_ILCompilerPackageReference Include="@(PackageReference)" Exclude="@(_PackageReferenceExceptILCompiler)" /> - + @(_ILCompilerPackageReference->'%(Version)') diff --git a/src/coreclr/nativeaot/docs/compiling.md b/src/coreclr/nativeaot/docs/compiling.md index 4bfc64409dc44f..31d60c3b1f53cb 100644 --- a/src/coreclr/nativeaot/docs/compiling.md +++ b/src/coreclr/nativeaot/docs/compiling.md @@ -2,7 +2,7 @@ Please consult [documentation](https://docs.microsoft.com/dotnet/core/deploying/native-aot) for instructions how to compile and publish application. -The rest of this document covers advanced topics only. Adding an explicit package references to 'Microsoft.DotNet.ILCompile' can generate warnings when publishing and is only supported on a narrow set of scenarios. When possible, use the SDK options to publish a native AOT application. +The rest of this document covers advanced topics only. Adding an explicit package references to 'Microsoft.DotNet.ILCompile' will generate warning when publishing and it can run into version errors. When possible, use the PublishAot property to publish a native AOT application. ## Using daily builds From 45866568ae3c4c1b2980dfba50621e49dceb9e25 Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Fri, 26 Aug 2022 15:27:13 -0700 Subject: [PATCH 3/5] Fix issue 27239 --- ...crosoft.DotNet.ILCompiler.SingleEntry.targets | 16 +++++++++------- .../Microsoft.DotNet.ILCompiler.props | 2 -- src/coreclr/nativeaot/docs/compiling.md | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index bdada2ed7f7932..84119c002b758e 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -36,16 +36,18 @@ SetupProperties - - - <_PackageReferenceExceptILCompiler Include="@(PackageReference)" Exclude="Microsoft.DotNet.ILCompiler" /> - <_ILCompilerPackageReference Include="@(PackageReference)" Exclude="@(_PackageReferenceExceptILCompiler)" /> - - - @(_ILCompilerPackageReference->'%(Version)') + + + + $([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetDirectoryName($(ILCompilerTargetsPath))))))) + + + + + diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.props b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.props index e0cc69015b8e16..c2f2f45bce605b 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.props +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.props @@ -11,8 +11,6 @@ Copyright (c) .NET Foundation. All rights reserved. --> - - true $(MSBuildThisFileDirectory)Microsoft.DotNet.ILCompiler.SingleEntry.targets diff --git a/src/coreclr/nativeaot/docs/compiling.md b/src/coreclr/nativeaot/docs/compiling.md index 31d60c3b1f53cb..a7bedce5ec9d5a 100644 --- a/src/coreclr/nativeaot/docs/compiling.md +++ b/src/coreclr/nativeaot/docs/compiling.md @@ -33,7 +33,21 @@ or by adding the following element to the project file: ## Cross-architecture compilation -Native AOT toolchain allows targeting ARM64 on an x64 host and vice versa for both Windows and Linux and is now supported in the SDK. Cross-OS compilation, such as targeting Linux on a Windows host, is not supported. To target win-arm64 on a Windows x64 host on an advanced scenario where the SDK support is not sufficient, in addition to the `Microsoft.DotNet.ILCompiler` package reference, also add the `runtime.win-x64.Microsoft.DotNet.ILCompiler` package reference to get the x64-hosted compiler: +Native AOT toolchain allows targeting ARM64 on an x64 host and vice versa for both Windows and Linux and is now supported in the SDK. Cross-OS compilation, such as targeting Linux on a Windows host, is not supported. For SDK support, add the following to your project file, + +```xml + + true + +``` + +Targeting win-arm64 on a Windows x64 host machine, + +```bash +> dotnet publish -r win-arm64 -c Release +``` + +To target win-arm64 on a Windows x64 host on an advanced scenario where the SDK support is not sufficient (note that these scenarios will generate warnings for using explicit package references), in addition to the `Microsoft.DotNet.ILCompiler` package reference, also add the `runtime.win-x64.Microsoft.DotNet.ILCompiler` package reference to get the x64-hosted compiler: ```xml ``` From a2f7c99f5951c4540d992f27821856b8e01d8be3 Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Fri, 26 Aug 2022 17:37:39 -0700 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Sven Boemer --- .../Microsoft.DotNet.ILCompiler.SingleEntry.targets | 4 ++-- src/coreclr/nativeaot/docs/compiling.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 84119c002b758e..81de7e600c0981 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -39,13 +39,13 @@ - $([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetDirectoryName($(ILCompilerTargetsPath))))))) + $([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetDirectoryName($(ILCompilerTargetsPath))))))) - + diff --git a/src/coreclr/nativeaot/docs/compiling.md b/src/coreclr/nativeaot/docs/compiling.md index a7bedce5ec9d5a..f142fa3afecb17 100644 --- a/src/coreclr/nativeaot/docs/compiling.md +++ b/src/coreclr/nativeaot/docs/compiling.md @@ -2,7 +2,7 @@ Please consult [documentation](https://docs.microsoft.com/dotnet/core/deploying/native-aot) for instructions how to compile and publish application. -The rest of this document covers advanced topics only. Adding an explicit package references to 'Microsoft.DotNet.ILCompile' will generate warning when publishing and it can run into version errors. When possible, use the PublishAot property to publish a native AOT application. +The rest of this document covers advanced topics only. Adding an explicit package reference to `Microsoft.DotNet.ILCompiler` will generate warning when publishing and it can run into version errors. When possible, use the PublishAot property to publish a native AOT application. ## Using daily builds From 24c5d998e31fea4482300d8a4f8de4a24565e01a Mon Sep 17 00:00:00 2001 From: Lakshan Fernando Date: Sat, 27 Aug 2022 04:20:23 -0700 Subject: [PATCH 5/5] exclude the warning for direct targets file invoke cases --- .../Microsoft.DotNet.ILCompiler.SingleEntry.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 84119c002b758e..d09276c7d19b9f 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -44,7 +44,7 @@ - +