@@ -105,7 +105,7 @@ Copyright (c) .NET Foundation. All rights reserved.
105105 '$(RuntimeIdentifier)' == '' and
106106 '$(_IsExecutable)' == 'true' and
107107 '$(IsRidAgnostic)' != 'true' and
108- '$(PackAsTool)' != true and
108+ ( '$(PackAsTool)' != ' true' or '$(_IsPacking)' != 'true') and
109109 (
110110 '$(SelfContained)' == 'true' or
111111 ('$(_IsPublishing)' == 'true' and
@@ -216,10 +216,8 @@ Copyright (c) .NET Foundation. All rights reserved.
216216 $([MSBuild]::VersionLessThan('$(_TargetFrameworkVersionWithoutV)', '5.0'))" >$(DefaultAppHostRuntimeIdentifier.Replace("arm64", "x64"))</DefaultAppHostRuntimeIdentifier >
217217 </PropertyGroup >
218218
219- <Target Name =" _CheckForUnsupportedAppHostUsage"
220- BeforeTargets =" _CheckForInvalidConfigurationAndPlatform"
221- Condition =" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(HasRuntimeOutput)' == 'true'" >
222-
219+ <Target Name =" _CheckRIDAsserts"
220+ Condition =" '$(PackAsTool)' != 'true' or '$(_IsPacking)' != 'true'" >
223221 <!-- The following RID errors are asserts, and we don't expect them to ever occur. The error message is added as a safeguard.-->
224222 <NETSdkError Condition =" '$(SelfContained)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(AllowSelfContainedWithoutRuntimeIdentifier)' != 'true'"
225223 ResourceName =" ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
@@ -237,6 +235,14 @@ Copyright (c) .NET Foundation. All rights reserved.
237235 ResourceName =" ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
238236 FormatArguments =" PublishAot" />
239237
238+ </Target >
239+
240+ <Target Name =" _CheckForUnsupportedAppHostUsage"
241+ BeforeTargets =" _CheckForInvalidConfigurationAndPlatform"
242+ DependsOnTargets =" _CheckRIDAsserts"
243+ Condition =" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(HasRuntimeOutput)' == 'true'" >
244+
245+
240246 <!-- End of implicit RID resolver checks.-->
241247
242248 <NETSdkError Condition =" '$(PublishSelfContained)' != 'true' and '$(PublishSelfContained)' != 'false' and '$(PublishSelfContained)' != ''"
0 commit comments