Skip to content

Commit d3332f9

Browse files
committed
restore RID-agnostic-only tool packaging
1 parent 897c950 commit d3332f9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ Copyright (c) .NET Foundation. All rights reserved.
3232
<PublishAot Condition="'$(RuntimeIdentifier)' == ''">false</PublishAot>
3333

3434
<!-- set up generation dependencies -->
35+
<!-- Tool implementation files are not included in the primary package when the tool has RID-specific packages. So only pack the tool implementation
36+
(and only depend on publish) if there are no RID-specific packages, or if the RuntimeIdentifier is set. -->
37+
<_ToolPackageShouldIncludeImplementation Condition=" '$(PackAsTool)' == 'true' And
38+
('$(ToolPackageRuntimeIdentifiers)' == '' Or '$(RuntimeIdentifier)' != '')">true</_ToolPackageShouldIncludeImplementation>
39+
<_ToolPackageShouldIncludeImplementation Condition="'$(_ToolPackageShouldIncludeImplementation)' == ''">false</_ToolPackageShouldIncludeImplementation>
3540
<!-- inner builds need publish content-->
36-
<_PackToolPublishDependency Condition=" '$(RuntimeIdentifier)' != '' and '$(GeneratePackageOnBuild)' != 'true' and $(IsPublishable) == 'true' ">Publish</_PackToolPublishDependency>
37-
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackTool</TargetsForTfmSpecificContentInPackage>
38-
<!-- outer build needs to generate RID-specific tool packages, but only if we're not AOT-ing (because we can't do xplat AOT). -->
41+
<_PackToolPublishDependency Condition=" '$(_ToolPackageShouldIncludeImplementation)' != '' and '$(GeneratePackageOnBuild)' != 'true' and $(IsPublishable) == 'true' ">Publish</_PackToolPublishDependency>
3942
<GenerateNuspecDependsOn Condition=" '$(ToolPackageRuntimeIdentifiers)' != '' and '$(RuntimeIdentifier)' == '' and '$(PublishAot)' != 'true' ">$(GenerateNuspecDependsOn);_CreateRIDSpecificToolPackages</GenerateNuspecDependsOn>
43+
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackTool</TargetsForTfmSpecificContentInPackage>
4044
</PropertyGroup>
4145
<!--
4246
@@ -94,8 +98,8 @@ Copyright (c) .NET Foundation. All rights reserved.
9498
<Target Name="PackTool" DependsOnTargets="SetPackToolProperties;GenerateToolsSettingsFileFromBuildProperty;PackToPublishDependencyIndirection;_PackToolValidation;PackToolImplementation" Condition=" '$(PackAsTool)' == 'true' ">
9599
<ItemGroup>
96100
<_GeneratedFiles Include="$(_ToolsSettingsFilePath)"/>
97-
<_PublishFilesRaw Condition="'$(RuntimeIdentifier)' != ''" Include="$(PublishDir)/**/*" />
98-
<_PublishFiles Condition="'$(RuntimeIdentifier)' != ''" Include="@(_PublishFilesRaw)">
101+
<_PublishFilesRaw Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="$(PublishDir)/**/*" />
102+
<_PublishFiles Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="@(_PublishFilesRaw)">
99103
<RelativePath>$([System.IO.Path]::GetRelativePath($(PublishDir), %(Identity)))</RelativePath>
100104
</_PublishFiles>
101105
</ItemGroup>

0 commit comments

Comments
 (0)