diff --git a/Directory.Build.targets b/Directory.Build.targets index dbdfed1de973..2ac6aada836e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -50,8 +50,15 @@ Update="Microsoft.NETCore.App" TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)" RuntimeFrameworkVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)" /> - + + + %(RuntimePackRuntimeIdentifiers);$(TargetRid) + + + $(MicrosoftNETCoreAppRuntimePackageVersion) + %(ILCompilerRuntimeIdentifiers);$(TargetRid) + $(MicrosoftAspNetCoreAppRefPackageVersion) $(SupportedRuntimeIdentifiers) + %(RuntimePackRuntimeIdentifiers);$(TargetRid) $(MicrosoftAspNetCoreAppRefPackageVersion) $(MicrosoftAspNetCoreAppRefPackageVersion) diff --git a/src/Layout/Directory.Build.props b/src/Layout/Directory.Build.props index 05792e065bd6..1a69c7a455db 100644 --- a/src/Layout/Directory.Build.props +++ b/src/Layout/Directory.Build.props @@ -13,6 +13,8 @@ true + + - <_DotnetAotTargetRidSupported Condition="$(TargetRid.StartsWith('win')) or $(TargetRid.StartsWith('linux')) or $(TargetRid.StartsWith('osx'))">true + <_DotnetAotTargetOSSupported Condition="'$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'osx'">true - - <_DotnetAotIsSameOSBuild Condition="$([MSBuild]::IsOSPlatform('WINDOWS')) and $(TargetRid.StartsWith('win'))">true - <_DotnetAotIsSameOSBuild Condition="$([MSBuild]::IsOSPlatform('OSX')) and $(TargetRid.StartsWith('osx'))">true - <_DotnetAotIsSameOSBuild Condition="$([MSBuild]::IsOSPlatform('LINUX')) and $(TargetRid.StartsWith('linux'))">true + + <_DotnetAotIsSameOSBuild Condition="'$(TargetOS)' == '$(HostOS)'">true - <_DotnetAotIsNativeBuild Condition="'$(_DotnetAotIsSameOSBuild)' == 'true' and '$(TargetArchitecture)' == '$(BuildArchitecture)' and '$(CrossBuild)' != 'true' and '$(DotNetBuildSourceOnly)' != 'true' and !$(TargetRid.StartsWith('linux-musl'))">true + <_DotnetAotIsNativeBuild Condition="'$(_DotnetAotIsSameOSBuild)' == 'true' and '$(TargetArchitecture)' == '$(BuildArchitecture)' and '$(CrossBuild)' != 'true' and '$(OSName)' != 'linux-musl'">true - <_DotnetAotIsCrossBuild Condition="'$(_DotnetAotIsSameOSBuild)' == 'true' and '$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(DotNetBuildSourceOnly)' != 'true' and !$(TargetRid.StartsWith('linux-musl')) and !($(TargetRid.StartsWith('linux')) and '$(CrossBuild)' != 'true')">true + <_DotnetAotIsCrossBuild Condition="'$(_DotnetAotIsSameOSBuild)' == 'true' and '$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(OSName)' != 'linux-musl' and !('$(TargetOS)' == 'linux' and '$(CrossBuild)' != 'true')">true - <_ShouldPublishDotnetAot Condition="'$(_ShouldPublishDotnetAot)' == '' and '$(_DotnetAotTargetRidSupported)' == 'true' and ('$(_DotnetAotIsNativeBuild)' == 'true' or '$(_DotnetAotIsCrossBuild)' == 'true')">true + <_ShouldPublishDotnetAot Condition="'$(_ShouldPublishDotnetAot)' == '' and '$(_DotnetAotTargetOSSupported)' == 'true' and '$(NativeAotSupported)' == 'true' and '$(DotNetBuildUseMonoRuntime)' != 'true' and ('$(_DotnetAotIsNativeBuild)' == 'true' or '$(_DotnetAotIsCrossBuild)' == 'true')">true <_ShouldPublishDotnetAot Condition="'$(_ShouldPublishDotnetAot)' == ''">false @@ -98,8 +99,6 @@ )">true - - true true diff --git a/src/Layout/redist/redist.csproj b/src/Layout/redist/redist.csproj index ead3a742dec4..198344108a59 100644 --- a/src/Layout/redist/redist.csproj +++ b/src/Layout/redist/redist.csproj @@ -88,10 +88,10 @@ race over shared bin\ and obj\ directories. This ProjectReference sequences the outer Build to complete before redist's GenerateSdkLayout target runs. - Conditioned on the same check as the PublishDotnetAot target itself (_ShouldPublishDotnetAot); - when NativeAOT publish doesn't run (e.g. source-build with TargetRid like centos.10-x64), - pulling dotnet-aot.csproj into the restore graph would demand the ILCompiler RID-specific - runtime pack, which isn't available from source-built feeds (NU1100). --> + Conditioned on the same check as the PublishDotnetAot target itself (_ShouldPublishDotnetAot) + so unsupported target platforms don't pull NativeAOT compiler/runtime packs into the restore + graph. Supported Source Build configurations produce these packs from source and retain this + project reference. --> diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets index 10421dfe99ff..8f9f2600a415 100644 --- a/src/Layout/redist/targets/GenerateLayout.targets +++ b/src/Layout/redist/targets/GenerateLayout.targets @@ -532,11 +532,11 @@ them entirely in native code, falling back to the managed dotnet.dll for other commands. The output is placed next to dotnet.dll so it's packaged with the SDK. - Runs for native builds (target OS/arch match the build host) on supported platforms, and for - same-OS cross-arch builds where NativeAOT targets a different architecture from the build host - (win-x64 -> win-arm64, osx-x64 -> osx-arm64, and Linux via the azurelinux cross containers that - provide a cross toolchain and target sysroot via ROOTFS_DIR). See the _ShouldPublishDotnetAot - property in src/Layout/Directory.Build.props. + Runs for native builds (target OS/arch match the build host) on supported platforms, including + Source Build with a distro-specific RID, and for same-OS cross-arch builds where NativeAOT targets + a different architecture from the build host (win-x64 -> win-arm64, osx-x64 -> osx-arm64, and + Linux via the azurelinux cross containers that provide a cross toolchain and target sysroot via + ROOTFS_DIR). See the _ShouldPublishDotnetAot property in src/Layout/Directory.Build.props. --> @@ -550,14 +550,13 @@ <_DotnetAotPublishProperties>_IsPublishing=true - <_DotnetAotPublishProperties Condition="'$(_DotnetAotIsCrossBuild)' == 'true'">$(_DotnetAotPublishProperties);CrossBuild=true;TargetArchitecture=$(TargetArchitecture);TargetRid=$(TargetRid) + <_DotnetAotPublishProperties Condition="'$(_DotnetAotIsCrossBuild)' == 'true'">$(_DotnetAotPublishProperties);CrossBuild=true