Skip to content

Commit 3feb0cf

Browse files
committed
[release/5.0] Clear layout directories before copies
- backport of #36719 Clear layout directories before copies (#36719) - `<Copy />` task (well, most tasks though not `tar` commands) will create directories - avoid leftover files from a previous build - avoid confusing SDK with an empty targeting pack directory - prevented ASP.NET targeting pack download when not building it (see #36718)
1 parent 3628abc commit 3feb0cf

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,19 @@ This package is an internal implementation of the .NET Core SDK and is not meant
189189
DependsOnTargets="_ResolveTargetingPackContent"
190190
Inputs="@(RefPackContent)"
191191
Outputs="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')">
192+
<RemoveDir Directories="$(TargetingPackLayoutRoot)" />
192193
<Copy SourceFiles="@(RefPackContent)"
193194
DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')"
194195
UseHardlinksIfPossible="true" />
195196
<Message Importance="High" Text="$(MSBuildProjectName) -> $(LayoutTargetDir)" />
196197
</Target>
197198

198-
<ItemGroup>
199-
<CreateDirectory Include="$(LocalInstallationOutputPath)" />
200-
</ItemGroup>
201-
202199
<!-- Workaround https://github.com/dotnet/sdk/issues/2910 by copying targeting pack into local installation. -->
203200
<Target Name="_InstallTargetingPackIntoLocalDotNet"
204201
DependsOnTargets="_ResolveTargetingPackContent"
205202
Inputs="@(RefPackContent)"
206203
Outputs="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(FileName)%(Extension)')">
204+
<RemoveDir Directories="$(LocalInstallationOutputPath)" />
207205
<Copy SourceFiles="@(RefPackContent)"
208206
DestinationFiles="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(FileName)%(Extension)')"
209207
UseHardlinksIfPossible="true" />

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,6 @@ This package is an internal implementation of the .NET Core SDK and is not meant
328328
<CrossgenPlatformAssembliesDir>$(IntermediateOutputPath)platformAssemblies\</CrossgenPlatformAssembliesDir>
329329
</PropertyGroup>
330330

331-
<ItemGroup>
332-
<CreateDirectory Include="$(CrossgenToolDir)" />
333-
<CreateDirectory Include="$(CrossgenPlatformAssembliesDir)" />
334-
<CreateDirectory Include="$(SharedFxLayoutTargetDir)" />
335-
<CreateDirectory Include="$(RedistLayoutTargetDir)" />
336-
<CreateDirectory Include="$(LocalInstallationOutputPath)" />
337-
</ItemGroup>
338-
339331
<Target Name="Crossgen" DependsOnTargets="$(CrossgenDependsOn)" />
340332

341333
<Target Name="_ExpandRuntimePackageRoot">
@@ -359,6 +351,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
359351
Condition="'$(CrossgenOutput)' == 'true'"
360352
DependsOnTargets="_ExpandRuntimePackageRoot">
361353
<!-- The output directories of assemblies built in this repo contain a mix of ref and impl assemblies. Copy impl assemblies to a separate directory. -->
354+
<RemoveDir Directories="$(CrossgenPlatformAssembliesDir)" />
362355
<Copy SourceFiles="@(ReferenceCopyLocalPaths)" DestinationFolder="$(CrossgenPlatformAssembliesDir)" Condition="'%(ReferenceCopyLocalPaths.ProjectPath)' != ''"/>
363356

364357
<!-- Resolve list of assemblies to crossgen -->
@@ -386,6 +379,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
386379
<CrossgenPlatformAssemblyPaths Condition="HasTrailingSlash($(CrossgenPlatformAssemblyPaths)) AND '$(OS)' == 'Windows_NT'">$(CrossgenPlatformAssemblyPaths)\</CrossgenPlatformAssemblyPaths>
387380
</PropertyGroup>
388381

382+
<RemoveDir Directories="$(CrossgenToolDir)" />
389383
<WriteLinesToFile
390384
Lines="-platform_assemblies_paths &quot;$(CrossgenPlatformAssemblyPaths)&quot;"
391385
File="$(CrossgenToolDir)PlatformAssembliesPaths.rsp"
@@ -437,6 +431,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant
437431
PrivateUri="$(DotNetRuntimePrivateDownloadUrl)"
438432
PrivateUriSuffix="$(DotNetAssetRootAccessTokenSuffix)"
439433
DestinationPath="$(DotNetRuntimeArchive)" />
434+
<RemoveDir Directories="$(RedistSharedFrameworkLayoutRoot)" />
435+
<MakeDir Directories="$(RedistSharedFrameworkLayoutRoot)" />
440436

441437
<!-- Extract the dotnet-runtime archive -->
442438
<Exec Condition="'$(ArchiveExtension)' == '.tar.gz'"
@@ -463,7 +459,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
463459
DependsOnTargets="_ResolveSharedFrameworkContent"
464460
Inputs="@(SharedFxContent)"
465461
Outputs="@(SharedFxContent->'$(SharedFxLayoutTargetDir)%(FileName)%(Extension)')">
466-
462+
<RemoveDir Directories="$(SharedFrameworkLayoutRoot)" />
467463
<Copy SourceFiles="@(SharedFxContent)"
468464
DestinationFiles="@(SharedFxContent->'$(SharedFxLayoutTargetDir)%(FileName)%(Extension)')"
469465
UseHardlinksIfPossible="true" />
@@ -475,7 +471,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
475471
DependsOnTargets="_ResolveSharedFrameworkContent"
476472
Inputs="@(SharedFxContent)"
477473
Outputs="@(SharedFxContent->'$(RedistLayoutTargetDir)%(FileName)%(Extension)')">
478-
474+
<RemoveDir Directories="$(RedistLayoutTargetDir)" />
479475
<Copy SourceFiles="@(SharedFxContent)"
480476
DestinationFiles="@(SharedFxContent->'$(RedistLayoutTargetDir)%(FileName)%(Extension)')"
481477
UseHardlinksIfPossible="true" />
@@ -488,7 +484,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
488484
Name="_InstallFrameworkIntoLocalDotNet"
489485
Inputs="@(SharedFxContent)"
490486
Outputs="@(SharedFxContent->'$(LocalInstallationOutputPath)%(FileName)%(Extension)')">
491-
487+
<RemoveDir Directories="$(LocalInstallationOutputPath)" />
492488
<Copy SourceFiles="@(SharedFxContent)"
493489
DestinationFiles="@(SharedFxContent->'$(LocalInstallationOutputPath)%(FileName)%(Extension)')"
494490
UseHardlinksIfPossible="true" />

0 commit comments

Comments
 (0)