Skip to content

Commit 6f65e7a

Browse files
committed
fix shim path packaging
1 parent 3f7212d commit 6f65e7a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ Copyright (c) .NET Foundation. All rights reserved.
106106
<Target Name="PackTool" DependsOnTargets="SetPackToolProperties;GenerateToolsSettingsFileFromBuildProperty;PackToPublishDependencyIndirection;_PackToolValidation;PackToolImplementation" Condition=" '$(PackAsTool)' == 'true' ">
107107
<ItemGroup>
108108
<_GeneratedFiles Include="$(_ToolsSettingsFilePath)"/>
109-
<_PublishFilesRaw Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="$(PublishDir)/**/*" />
110-
<_PublishFiles Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="@(_PublishFilesRaw)">
111-
<RelativePath>$([System.IO.Path]::GetRelativePath($(PublishDir), $([System.IO.Path]::GetDirectoryName(%(Identity)))))</RelativePath>
112-
</_PublishFiles>
109+
<!-- Note here that we're _not_ computing relative directories inside the package anymore. In our packages, we essentially want to
110+
recreate the publish layout, but under a TFM- or RID-specific root path. Because we're globbing from the PublishDir,
111+
the MSBuild Items will have the RecursiveDir metadata - this is used by the PackLogic to combine with the PackagePath
112+
we set below to ensure we have the correct layout in the end. If the PackLogic didn't try to use RecursiveDir, then
113+
we could just explicitly set everything ourselves. -->
114+
<_PublishFiles Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="$(PublishDir)/**/*" />
113115
</ItemGroup>
114116

115117
<PropertyGroup>
@@ -121,8 +123,11 @@ Copyright (c) .NET Foundation. All rights reserved.
121123
<PackagePath>tools/$(_ToolPackShortTargetFrameworkName)/$(_ToolRidPath)/%(_GeneratedFiles.RecursiveDir)</PackagePath>
122124
</TfmSpecificPackageFile>
123125

126+
<!-- This PackagePath is a little different - instead of mapping _exactly_ where we want the files to be dropped,
127+
NuGet is looking at RecursiveDir/NuGetRecursiveDir metadata (which is set in the Pack targets as part of the
128+
'walk target per TFM' logic) _in addition_ to our package path. I don't see an easy way to remove RecursiveDir -->
124129
<TfmSpecificPackageFile Include="@(_PublishFiles)">
125-
<PackagePath>tools/$(_ToolPackShortTargetFrameworkName)/$(_ToolRidPath)/%(_PublishFiles.RelativePath)</PackagePath>
130+
<PackagePath>tools/$(_ToolPackShortTargetFrameworkName)/$(_ToolRidPath)/</PackagePath>
126131
</TfmSpecificPackageFile>
127132
</ItemGroup>
128133
</Target>

0 commit comments

Comments
 (0)