Skip to content

Commit 186280c

Browse files
committed
Clear layout directories before copies
- `<Copy />` task 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 db4dc17 commit 186280c

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
@@ -214,21 +214,19 @@ This package is an internal implementation of the .NET Core SDK and is not meant
214214
DependsOnTargets="_ResolveTargetingPackContent"
215215
Inputs="@(RefPackContent)"
216216
Outputs="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(RecursiveDir)%(FileName)%(Extension)')">
217+
<RemoveDir Directories="$(TargetingPackLayoutRoot)" />
217218
<Copy SourceFiles="@(RefPackContent)"
218219
DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(RecursiveDir)%(FileName)%(Extension)')"
219220
UseHardlinksIfPossible="true" />
220221
<Message Importance="High" Text="$(MSBuildProjectName) -> $(LayoutTargetDir)" />
221222
</Target>
222223

223-
<ItemGroup>
224-
<CreateDirectory Include="$(LocalInstallationOutputPath)" />
225-
</ItemGroup>
226-
227224
<!-- Workaround https://github.com/dotnet/sdk/issues/2910 by copying targeting pack into local installation. -->
228225
<Target Name="_InstallTargetingPackIntoLocalDotNet"
229226
DependsOnTargets="_ResolveTargetingPackContent"
230227
Inputs="@(RefPackContent)"
231228
Outputs="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(RecursiveDir)%(FileName)%(Extension)')">
229+
<RemoveDir Directories="$(LocalInstallationOutputPath)" />
232230
<Copy SourceFiles="@(RefPackContent)"
233231
DestinationFiles="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(RecursiveDir)%(FileName)%(Extension)')"
234232
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
@@ -349,14 +349,6 @@ This package is an internal implementation of the .NET Core SDK and is not meant
349349
<CrossgenPlatformAssembliesDir>$(IntermediateOutputPath)platformAssemblies\</CrossgenPlatformAssembliesDir>
350350
</PropertyGroup>
351351

352-
<ItemGroup>
353-
<CreateDirectory Include="$(CrossgenToolDir)" />
354-
<CreateDirectory Include="$(CrossgenPlatformAssembliesDir)" />
355-
<CreateDirectory Include="$(SharedFxLayoutTargetDir)" />
356-
<CreateDirectory Include="$(RedistLayoutTargetDir)" />
357-
<CreateDirectory Include="$(LocalInstallationOutputPath)" />
358-
</ItemGroup>
359-
360352
<Target Name="Crossgen" DependsOnTargets="$(CrossgenDependsOn)" />
361353

362354
<Target Name="_ExpandRuntimePackageRoot">
@@ -386,6 +378,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
386378
Condition="'$(CrossgenOutput)' == 'true'"
387379
DependsOnTargets="_ExpandRuntimePackageRoot">
388380
<!-- The output directories of assemblies built in this repo contain a mix of ref and impl assemblies. Copy impl assemblies to a separate directory. -->
381+
<RemoveDir Directories="$(CrossgenPlatformAssembliesDir)" />
389382
<Copy SourceFiles="@(ReferenceCopyLocalPaths)" DestinationFolder="$(CrossgenPlatformAssembliesDir)" Condition="'%(ReferenceCopyLocalPaths.ProjectPath)' != ''"/>
390383

391384
<!-- Resolve list of assemblies to crossgen2 -->
@@ -418,6 +411,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
418411
<CrossgenSymbolsTargetDir Condition="HasTrailingSlash($(CrossgenSymbolsTargetDir)) AND '$(OS)' == 'Windows_NT'">$(TargetDir)\</CrossgenSymbolsTargetDir>
419412
</PropertyGroup>
420413

414+
<RemoveDir Directories="$(CrossgenToolDir)" />
421415
<WriteLinesToFile
422416
Lines="@(Crossgen2PlatformAssemblyPaths)"
423417
File="$(CrossgenToolDir)PlatformAssembliesPathsCrossgen2.rsp"
@@ -474,6 +468,8 @@ This package is an internal implementation of the .NET Core SDK and is not meant
474468
PrivateUri="$(DotNetRuntimePrivateDownloadUrl)"
475469
PrivateUriSuffix="$(DotNetAssetRootAccessTokenSuffix)"
476470
DestinationPath="$(DotNetRuntimeArchive)" />
471+
<RemoveDir Directories="$(RedistSharedFrameworkLayoutRoot)" />
472+
<MakeDir Directories="$(RedistSharedFrameworkLayoutRoot)" />
477473

478474
<!-- Extract the dotnet-runtime archive -->
479475
<Exec Condition="'$(ArchiveExtension)' == '.tar.gz'"
@@ -500,7 +496,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
500496
DependsOnTargets="_ResolveSharedFrameworkContent"
501497
Inputs="@(SharedFxContent)"
502498
Outputs="@(SharedFxContent->'$(SharedFxLayoutTargetDir)%(FileName)%(Extension)')">
503-
499+
<RemoveDir Directories="$(SharedFrameworkLayoutRoot)" />
504500
<Copy SourceFiles="@(SharedFxContent)"
505501
DestinationFiles="@(SharedFxContent->'$(SharedFxLayoutTargetDir)%(FileName)%(Extension)')"
506502
UseHardlinksIfPossible="true" />
@@ -512,7 +508,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
512508
DependsOnTargets="_ResolveSharedFrameworkContent"
513509
Inputs="@(SharedFxContent)"
514510
Outputs="@(SharedFxContent->'$(RedistLayoutTargetDir)%(FileName)%(Extension)')">
515-
511+
<RemoveDir Directories="$(RedistLayoutTargetDir)" />
516512
<Copy SourceFiles="@(SharedFxContent)"
517513
DestinationFiles="@(SharedFxContent->'$(RedistLayoutTargetDir)%(FileName)%(Extension)')"
518514
UseHardlinksIfPossible="true" />
@@ -526,7 +522,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
526522
Condition="'$(DotNetBuildFromSource)' != 'true'"
527523
Inputs="@(SharedFxContent)"
528524
Outputs="@(SharedFxContent->'$(LocalInstallationOutputPath)%(FileName)%(Extension)')">
529-
525+
<RemoveDir Directories="$(LocalInstallationOutputPath)" />
530526
<Copy SourceFiles="@(SharedFxContent)"
531527
DestinationFiles="@(SharedFxContent->'$(LocalInstallationOutputPath)%(FileName)%(Extension)')"
532528
UseHardlinksIfPossible="true" />

0 commit comments

Comments
 (0)