Skip to content

Commit a0a1209

Browse files
authored
[release/10.0] Restore trimming test projects serially (#65798)
* Retry restore in linker tests if first one fails * Fixup * New approach
1 parent 34ac9fa commit a0a1209

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

eng/testing/linker/trimmingTests.targets

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,20 @@
129129
<Target Name="Test" DependsOnTargets="ExecuteApplications" />
130130
<Target Name="VSTest" DependsOnTargets="Test" />
131131

132-
<!-- define Restore/Build to do nothing, for this project only Test does the testing -->
133-
<Target Name="Restore" />
132+
<!--
133+
The Restore target generates and restores the trimming test projects. BuildAfterTargetingPack.csproj calls
134+
Restore on all delayed-build .proj files with BuildInParallel="false", which serializes these restores and
135+
avoids a NuGet file-move race on Windows where concurrent static-graph restores race when committing
136+
project.assets.json for shared ProjectReference targets (https://github.com/dotnet/aspnetcore/issues/61178).
137+
PublishTrimmedProjects also restores as a fallback for local dev where Restore may not be called separately;
138+
after the serialized Restore phase in CI those calls are fast no-ops.
139+
-->
140+
<Target Name="Restore" DependsOnTargets="GenerateProjects">
141+
<MSBuild Projects="@(TestConsoleApps)"
142+
BuildInParallel="false"
143+
Targets="Restore"
144+
Condition="'$(SkipTrimmingProjectsRestore)' != 'true'"
145+
Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid());Configuration=$(Configuration);RestoreDisableParallel=true" />
146+
</Target>
134147
<Target Name="Build" />
135148
</Project>

0 commit comments

Comments
 (0)