@@ -32,11 +32,15 @@ Copyright (c) .NET Foundation. All rights reserved.
32
32
<PublishAot Condition =" '$(RuntimeIdentifier)' == ''" >false</PublishAot >
33
33
34
34
<!-- 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 >
35
40
<!-- 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 >
39
42
<GenerateNuspecDependsOn Condition =" '$(ToolPackageRuntimeIdentifiers)' != '' and '$(RuntimeIdentifier)' == '' and '$(PublishAot)' != 'true' " >$(GenerateNuspecDependsOn);_CreateRIDSpecificToolPackages</GenerateNuspecDependsOn >
43
+ <TargetsForTfmSpecificContentInPackage >$(TargetsForTfmSpecificContentInPackage);PackTool</TargetsForTfmSpecificContentInPackage >
40
44
</PropertyGroup >
41
45
<!--
42
46
@@ -94,8 +98,8 @@ Copyright (c) .NET Foundation. All rights reserved.
94
98
<Target Name =" PackTool" DependsOnTargets =" SetPackToolProperties;GenerateToolsSettingsFileFromBuildProperty;PackToPublishDependencyIndirection;_PackToolValidation;PackToolImplementation" Condition =" '$(PackAsTool)' == 'true' " >
95
99
<ItemGroup >
96
100
<_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)" >
99
103
<RelativePath >$([System.IO.Path]::GetRelativePath($(PublishDir), %(Identity)))</RelativePath >
100
104
</_PublishFiles >
101
105
</ItemGroup >
0 commit comments