Repository navigation
Fix pack-publish race in ApiCompat.Task / GenAPI.Task by deduplicating the Publish build - #54591
Merged
MichaelSimons merged 3 commits intoJun 9, 2026
Conversation
…g the Publish configuration PR dotnet#54567 did not eliminate, the intermittent "file in use" race (MSB3026/MSB3027) when packing these tooling packages. This is because TargetFramework is set as a global property when AddBuildOutputToPackageCore runs, so we still ended up having duplicate builds of the project. Fix: run Publish via an <MSBuild> task call with RemoveProperties="TargetFramework" so the request deduplicates with other builds of the project (since the global properties are the same). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an intermittent MSBuild “file in use” race (MSB3026/MSB3027) during pack for Microsoft.DotNet.ApiCompat.Task and Microsoft.DotNet.GenAPI.Task by ensuring the Publish build request is deduplicated (removing TargetFramework from the MSBuild task’s global properties).
Changes:
- Replace
_AddBuildOutputToPackageCore’sDependsOnTargets="Publish"with an explicit<MSBuild Targets="Publish" RemoveProperties="TargetFramework" />invocation. - Add inline comments explaining why
TargetFrameworkmust be removed to avoid duplicate builds during NuGet’s pack walk.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Compatibility/GenAPI/Microsoft.DotNet.GenAPI.Task/Microsoft.DotNet.GenAPI.Task.csproj | Invokes Publish via an MSBuild task with RemoveProperties="TargetFramework" to avoid duplicate pack-time builds. |
| src/Compatibility/ApiCompat/Microsoft.DotNet.ApiCompat.Task/Microsoft.DotNet.ApiCompat.Task.csproj | Same deduplication approach for ApiCompat task publishing during pack. |
This was referenced Jun 4, 2026
Open
MichaelSimons
approved these changes
Jun 5, 2026
joeloff
approved these changes
Jun 8, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #54567 did not eliminate, the intermittent "file in use" race (MSB3026/MSB3027) when packing these tooling packages. This is because TargetFramework is set as a global property when AddBuildOutputToPackageCore runs, so we still ended up having duplicate builds of the project.
Fix: run Publish via an task call with RemoveProperties="TargetFramework" so the request deduplicates with other builds of the project (since the global properties are the same).