Skip to content

Commit f37177c

Browse files
committed
Fix packaging tools that are multi-tfm
1 parent e9f8347 commit f37177c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Copyright (c) .NET Foundation. All rights reserved.
3030
<SelfContained Condition="'$(RuntimeIdentifier)' == ''">false</SelfContained>
3131
<PublishTrimmed Condition="'$(RuntimeIdentifier)' == ''">false</PublishTrimmed>
3232
<PublishReadyToRun Condition="'$(RuntimeIdentifier)' == ''">false</PublishReadyToRun>
33+
<_InnerToolsPublishAot>false</_InnerToolsPublishAot>
34+
<_InnerToolsPublishAot Condition="'$(RuntimeIdentifier)' == '' and '$(PublishAot)' == 'true'">true</_InnerToolsPublishAot>
3335
<PublishAot Condition="'$(RuntimeIdentifier)' == ''">false</PublishAot>
3436

3537
<!-- we want to ensure that we don't publish any AppHosts for the 'outer', RID-agnostic builds -->
@@ -47,7 +49,7 @@ Copyright (c) .NET Foundation. All rights reserved.
4749
<!-- Tool implementation files are not included in the primary package when the tool has RID-specific packages. So only pack the tool implementation
4850
(and only depend on publish) if there are no RID-specific packages, or if the RuntimeIdentifier is set. -->
4951
<_ToolPackageShouldIncludeImplementation Condition=" '$(PackAsTool)' == 'true' And
50-
('$(ToolPackageRuntimeIdentifiers)' == '' Or '$(RuntimeIdentifier)' != '')">true</_ToolPackageShouldIncludeImplementation>
52+
('$(_UserSpecifiedToolPackageRids)' == '' Or '$(RuntimeIdentifier)' != '')">true</_ToolPackageShouldIncludeImplementation>
5153
<_ToolPackageShouldIncludeImplementation Condition="'$(_ToolPackageShouldIncludeImplementation)' == ''">false</_ToolPackageShouldIncludeImplementation>
5254
<_HasRIDSpecificTools Condition=" '$(_UserSpecifiedToolPackageRids)' != '' ">true</_HasRIDSpecificTools>
5355
<_HasRIDSpecificTools Condition="'$(_HasRIDSpecificTools)' == ''">false</_HasRIDSpecificTools>
@@ -60,7 +62,7 @@ Copyright (c) .NET Foundation. All rights reserved.
6062
<_PackToolPublishDependency Condition=" '$(_ToolPackageShouldIncludeImplementation)' != '' and '$(GeneratePackageOnBuild)' == 'true' and $(IsPublishable) == 'true' ">$(_PublishNoBuildAlternativeDependsOn)</_PackToolPublishDependency>
6163

6264
<!-- Trigger RID-specific inner builds if RID-specific mode is enabled-->
63-
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);_CreateRIDSpecificToolPackages</GenerateNuspecDependsOn>
65+
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);SetDotnetToolPackageType;_CreateRIDSpecificToolPackages</GenerateNuspecDependsOn>
6466

6567
<!-- finally set up the entrypoint for all tool-content regardless of tool type-->
6668
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackTool</TargetsForTfmSpecificContentInPackage>
@@ -321,9 +323,7 @@ Copyright (c) .NET Foundation. All rights reserved.
321323

322324
<UsingTask TaskName="AddPackageType" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
323325

324-
<Target Name="SetDotnetToolPackageType"
325-
Condition=" '$(PackAsTool)' == 'true' "
326-
BeforeTargets="GenerateNuspec">
326+
<Target Name="SetDotnetToolPackageType">
327327

328328
<PropertyGroup>
329329
<_ToolPackageType Condition="'$(RuntimeIdentifier)' != '' And '$(_HasRIDSpecificTools)' != ''">DotnetToolRidPackage</_ToolPackageType>
@@ -354,7 +354,7 @@ Copyright (c) .NET Foundation. All rights reserved.
354354
</Target>
355355

356356
<!-- orchestrator for making the N RID-specific tool packages -->
357-
<Target Name="_CreateRIDSpecificToolPackages" Condition="'$(RuntimeIdentifier)' == '' and $(_HasRIDSpecificTools) and '$(PublishAot)' != 'true'">
357+
<Target Name="_CreateRIDSpecificToolPackages" Condition="'$(RuntimeIdentifier)' == '' and $(_HasRIDSpecificTools) and !$(_InnerToolsPublishAot) and !$(_ToolPackageShouldIncludeImplementation)">
358358
<PropertyGroup>
359359
<_PackageRids>$(ToolPackageRuntimeIdentifiers)</_PackageRids>
360360
<_PackageRids Condition="'$(_PackageRids)' == ''">$(RuntimeIdentifiers)</_PackageRids>

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.CrossTargeting.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Copyright (c) .NET Foundation. All rights reserved.
1313

1414
<Import Project="Microsoft.NET.Sdk.Common.targets"/>
1515
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.SourceLink.targets" Condition="'$(SuppressImplicitGitSourceLink)' != 'true'"/>
16+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.PackTool.targets" Condition="'$(PackAsTool)' == 'true'" />
1617

1718
<!--
1819
============================================================

0 commit comments

Comments
 (0)