Skip to content

Commit 3f7212d

Browse files
committed
WIP: diagnosing why shims are ended up in nested dirs during packaging
1 parent 89b95d4 commit 3f7212d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Copyright (c) .NET Foundation. All rights reserved.
3030
<PublishTrimmed Condition="'$(RuntimeIdentifier)' == ''">false</PublishTrimmed>
3131
<PublishReadyToRun Condition="'$(RuntimeIdentifier)' == ''">false</PublishReadyToRun>
3232
<PublishAot Condition="'$(RuntimeIdentifier)' == ''">false</PublishAot>
33+
<!-- If shims are included, we need to make sure we restore for those RIDs so the apphost shims are available during restore/publish -->
34+
<RuntimeIdentifiers Condition="'$(PackAsToolShimRuntimeIdentifiers)' != ''">$(RuntimeIdentifiers);$(PackAsToolShimRuntimeIdentifiers)</RuntimeIdentifiers>
3335

3436
<!-- Tool implementation files are not included in the primary package when the tool has RID-specific packages. So only pack the tool implementation
3537
(and only depend on publish) if there are no RID-specific packages, or if the RuntimeIdentifier is set. -->
@@ -106,7 +108,7 @@ Copyright (c) .NET Foundation. All rights reserved.
106108
<_GeneratedFiles Include="$(_ToolsSettingsFilePath)"/>
107109
<_PublishFilesRaw Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="$(PublishDir)/**/*" />
108110
<_PublishFiles Condition="'$(_ToolPackageShouldIncludeImplementation)' == 'true'" Include="@(_PublishFilesRaw)">
109-
<RelativePath>$([System.IO.Path]::GetRelativePath($(PublishDir), %(Identity)))</RelativePath>
111+
<RelativePath>$([System.IO.Path]::GetRelativePath($(PublishDir), $([System.IO.Path]::GetDirectoryName(%(Identity)))))</RelativePath>
110112
</_PublishFiles>
111113
</ItemGroup>
112114

@@ -116,7 +118,7 @@ Copyright (c) .NET Foundation. All rights reserved.
116118
</PropertyGroup>
117119
<ItemGroup>
118120
<TfmSpecificPackageFile Include="@(_GeneratedFiles)">
119-
<PackagePath>tools/$(_ToolPackShortTargetFrameworkName)/$(_ToolRidPath)/%(_GeneratedFiles.RecursiveDir)%(_GeneratedFiles.Filename)%(_GeneratedFiles.Extension)</PackagePath>
121+
<PackagePath>tools/$(_ToolPackShortTargetFrameworkName)/$(_ToolRidPath)/%(_GeneratedFiles.RecursiveDir)</PackagePath>
120122
</TfmSpecificPackageFile>
121123

122124
<TfmSpecificPackageFile Include="@(_PublishFiles)">
@@ -232,7 +234,7 @@ Copyright (c) .NET Foundation. All rights reserved.
232234
ApphostsForShimRuntimeIdentifiers="@(_ApphostsForShimRuntimeIdentifiers)"
233235
IntermediateAssembly="@(IntermediateAssembly->'%(FullPath)')"
234236
OutputType="$(OutputType)"
235-
PackagedShimOutputDirectory="$(PackagedShimOutputRootDirectory)/shims/$(_ToolPackShortTargetFrameworkName)"
237+
PackagedShimOutputDirectory="$(PackagedShimOutputRootDirectory)shims/$(_ToolPackShortTargetFrameworkName)"
236238
PackageId="$(PackageId)"
237239
PackageVersion="$(PackageVersion)"
238240
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
@@ -261,7 +263,7 @@ Copyright (c) .NET Foundation. All rights reserved.
261263

262264
<Target Name="_ComputeExpectedEmbeddedApphostPaths">
263265
<GetEmbeddedApphostPaths
264-
PackagedShimOutputDirectory="$(PackagedShimOutputRootDirectory)/shims/$(_ToolPackShortTargetFrameworkName)"
266+
PackagedShimOutputDirectory="$(PackagedShimOutputRootDirectory)shims/$(_ToolPackShortTargetFrameworkName)"
265267
ShimRuntimeIdentifiers="@(_PackAsToolShimRuntimeIdentifiers)"
266268
ToolCommandName="$(ToolCommandName)">
267269

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ Copyright (c) .NET Foundation. All rights reserved.
4242
<DotnetCliToolTargetFramework>netcoreapp2.2</DotnetCliToolTargetFramework>
4343
</PropertyGroup>
4444

45-
<PropertyGroup Condition=" '$(PackAsTool)' == 'true' ">
46-
<IncludeBuildOutput>false</IncludeBuildOutput>
47-
<RuntimeIdentifiers>$(RuntimeIdentifiers);$(PackAsToolShimRuntimeIdentifiers)</RuntimeIdentifiers>
48-
</PropertyGroup>
49-
5045
<UsingTask TaskName="AddPackageType" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
5146

5247
<Target Name="SetDotnetToolPackageType"

0 commit comments

Comments
 (0)