Skip to content

Commit f3c3dbd

Browse files
authored
Fix build ordering issue when dotnet-sdk depends on redist (#48800)
1 parent d93c427 commit f3c3dbd

File tree

9 files changed

+28
-21
lines changed

9 files changed

+28
-21
lines changed

src/Layout/VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers/VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers.proj

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@
2424
</PropertyGroup>
2525

2626
<ItemGroup>
27-
<RuntimeAnalyzersContent Include="$(ArtifactsBinDir)Microsoft.Net.Sdk.AnalyzerRedirecting\$(Configuration)\net472\**\*.*" DeploymentSubpath="AnalyzerRedirecting" />
28-
<RuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)packs\Microsoft.NetCore.App.Ref\*\analyzers\**\*.*" DeploymentSubpath="NetCoreAnalyzers" />
29-
<RuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)packs\Microsoft.WindowsDesktop.App.Ref\*\analyzers\**\*.*" DeploymentSubpath="WindowsDesktopAnalyzers" />
30-
<RuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)packs\Microsoft.AspNetCore.App.Ref\*\analyzers\**\*.*" DeploymentSubpath="AspNetCoreAnalyzers" />
31-
<RuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)sdk\*\Sdks\Microsoft.NET.Sdk\analyzers\**\*.*" DeploymentSubpath="SDKAnalyzers" />
32-
<RuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)sdk\*\Sdks\Microsoft.NET.Sdk.Web\analyzers\**\*.*" DeploymentSubpath="WebSDKAnalyzers" />
27+
<RedistRuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)packs\Microsoft.NetCore.App.Ref\*\analyzers\**\*.*" DeploymentSubpath="NetCoreAnalyzers" />
28+
<RedistRuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)packs\Microsoft.WindowsDesktop.App.Ref\*\analyzers\**\*.*" DeploymentSubpath="WindowsDesktopAnalyzers" />
29+
<RedistRuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)packs\Microsoft.AspNetCore.App.Ref\*\analyzers\**\*.*" DeploymentSubpath="AspNetCoreAnalyzers" />
30+
<RedistRuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)sdk\*\Sdks\Microsoft.NET.Sdk\analyzers\**\*.*" DeploymentSubpath="SDKAnalyzers" />
31+
<RedistRuntimeAnalyzersContent Include="$(RedistInstallerLayoutPath)sdk\*\Sdks\Microsoft.NET.Sdk.Web\analyzers\**\*.*" DeploymentSubpath="WebSDKAnalyzers" />
32+
<RedirectingRuntimeAnalyzersContent Include="$(ArtifactsBinDir)Microsoft.Net.Sdk.AnalyzerRedirecting\$(Configuration)\net472\**\*.*" DeploymentSubpath="AnalyzerRedirecting" />
33+
</ItemGroup>
34+
35+
<Error Condition="'@(RedistRuntimeAnalyzersContent)' == ''" Text="The 'RedistRuntimeAnalyzersContent' items are empty. This shouldn't happen!" />
36+
<Error Condition="'@(RedirectingRuntimeAnalyzersContent)' == ''" Text="The 'RedirectingRuntimeAnalyzersContent' items are empty. This shouldn't happen!" />
37+
38+
<ItemGroup>
39+
<RuntimeAnalyzersContent Include="@(RedistRuntimeAnalyzersContent);@(RedirectingRuntimeAnalyzersContent)" />
3340
</ItemGroup>
3441

3542
<Copy SourceFiles="@(RuntimeAnalyzersContent)"

src/Layout/pkg/dotnet-sdk.proj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
</PropertyGroup>
3030

3131
<ItemGroup>
32-
<ProjectReference Include="..\redist\redist.csproj" ReferenceOutputAssembly="false" />
32+
<!-- The PublishToDisk target which depends on ResolveProjectReferences is invoked with OutputPath as an global property
33+
which would flow to redist.csproj. -->
34+
<ProjectReference Include="..\redist\redist.csproj" ReferenceOutputAssembly="false" GlobalPropertiesToRemove="OutputPath" />
3335
</ItemGroup>
3436

3537
<ItemGroup>
@@ -42,7 +44,7 @@
4244
<ManpagesDirectory>$(RepoRoot)documentation/manpages/sdk</ManpagesDirectory>
4345
</PropertyGroup>
4446

45-
<Target Name="PublishToDisk">
47+
<Target Name="PublishToDisk" DependsOnTargets="ResolveProjectReferences">
4648
<Error Condition="'$(OutputPath)' == ''" Text="Publishing to disk requires the OutputPath to be set to the root of the path to write to." />
4749

4850
<ItemGroup>
@@ -52,6 +54,7 @@
5254
</ItemGroup>
5355

5456
<!-- Create layout: Binaries -->
57+
<Error Condition="'@(CLISdkFiles)' == ''" Text="The 'CLISdkFiles' items are empty. This shouldn't happen!" />
5558
<Copy
5659
DestinationFiles="@(CLISdkFiles->'$(OutputPath)/sdk/%(RecursiveDir)%(Filename)%(Extension)')"
5760
SourceFiles="@(CLISdkFiles)"
@@ -60,6 +63,7 @@
6063
UseHardlinksIfPossible="False" />
6164

6265
<!-- Create layout: Templates -->
66+
<Error Condition="'@(TemplatesFiles)' == ''" Text="The 'TemplatesFiles' items are empty. This shouldn't happen!" />
6367
<Copy
6468
DestinationFiles="@(TemplatesFiles->'$(OutputPath)/templates/%(RecursiveDir)%(Filename)%(Extension)')"
6569
SourceFiles="@(TemplatesFiles)"
@@ -68,6 +72,7 @@
6872
UseHardlinksIfPossible="False" />
6973

7074
<!-- Create layout: Workload Manifests -->
75+
<Error Condition="'@(ManifestFiles)' == ''" Text="The 'ManifestFiles' items are empty. This shouldn't happen!" />
7176
<Copy
7277
DestinationFiles="@(ManifestFiles->'$(OutputPath)/sdk-manifests/%(RecursiveDir)%(Filename)%(Extension)')"
7378
SourceFiles="@(ManifestFiles)"

src/Layout/redist/targets/Crossgen.targets

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,9 @@
194194
<!-- Move symbols to separate folder, they are not included in the layout but are published separately -->
195195
<Move SourceFiles="@(PdbsToMove)"
196196
DestinationFiles="@(PdbsToMove->'$(ArtifactsSymStoreDirectory)/sdk/$(Version)/%(RecursiveDir)%(Filename)%(Extension)')" />
197-
</Target>
198-
199-
<Target Name="ChmodLayout"
200-
AfterTargets="CrossgenLayout"
201-
Condition=" '$(OSName)' != 'win' ">
202197

203-
<Exec Command="find $(InstallerOutputDirectory) -type d -exec chmod 755 {} \;" />
204-
<Exec Command="find $(InstallerOutputDirectory) -type f -exec chmod 644 {} \;" />
198+
<Exec Command="find $(InstallerOutputDirectory) -type d -exec chmod 755 {} \;" Condition="'$(OSName)' != 'win'" />
199+
<Exec Command="find $(InstallerOutputDirectory) -type f -exec chmod 644 {} \;" Condition="'$(OSName)' != 'win'" />
205200
</Target>
206201

207202
</Project>

src/Layout/redist/targets/GenerateArchives.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<Target Name="GenerateArchives"
44
DependsOnTargets="GenerateInstallerLayout"
5-
AfterTargets="Build">
5+
AfterTargets="AfterBuild">
66
<!-- When running in Docker under a Windows host, tar is warning "file changed as we read it" for several files and returning exit code 1.
77
So this flag allows that to be ignored. -->
88
<PropertyGroup Condition="'$(IgnoreTarExitCode)' == ''">

src/Layout/redist/targets/GenerateInstallerLayout.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
LayoutWorkloadUserLocalMarker;
8484
CrossgenLayout;
8585
ReplaceBundledRuntimePackFilesWithSymbolicLinks"
86-
AfterTargets="Build" />
86+
AfterTargets="AfterBuild" />
8787

8888
<!-- Copy the sdk layout into a temporary folder so that it's nested under "sdk\$(Version)\" which is
8989
necessary for the msi/pkg to install correctly and put the content under that sub path. -->

src/Layout/redist/targets/GenerateLayout.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,6 @@
546546
RetargetTools;
547547
RemoveResourcesFromDotnetDeps;
548548
ChmodPublishDir"
549-
AfterTargets="Build" />
549+
AfterTargets="AfterBuild" />
550550

551551
</Project>

src/Layout/redist/targets/GenerateMSIs.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@
378378
</Target>
379379

380380
<Target Name="GenerateMsis"
381-
AfterTargets="Build"
381+
AfterTargets="AfterBuild"
382382
DependsOnTargets="$(GenerateMsisDependsOn)" />
383383

384384
</Project>

src/Layout/redist/targets/GeneratePKG.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
</Target>
227227

228228
<Target Name="GeneratePkgs"
229-
AfterTargets="Build"
229+
AfterTargets="AfterBuild"
230230
DependsOnTargets="GenerateSdkPkg;GenerateSdkProductArchive" />
231231

232232
</Project>

src/Layout/redist/targets/OverlaySdkOnLKG.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TestHostFolder>$(ArtifactsBinDir)redist\$(Configuration)\dotnet\</TestHostFolder>
55
</PropertyGroup>
66

7-
<Target Name="OverlaySdkOnLKG" AfterTargets="Build" DependsOnTargets="GenerateInstallerLayout">
7+
<Target Name="OverlaySdkOnLKG" AfterTargets="AfterBuild" DependsOnTargets="GenerateInstallerLayout">
88
<PropertyGroup>
99
<_DotNetHiveRoot>$(DOTNET_INSTALL_DIR)</_DotNetHiveRoot>
1010
<_DotNetHiveRoot Condition="'$(_DotNetHiveRoot)' == ''">$(RepoRoot).dotnet/</_DotNetHiveRoot>

0 commit comments

Comments
 (0)