Fix Analyzers build race condition and sync unofficial pipeline#15183
Closed
joperezr wants to merge 3 commits intomicrosoft:release/13.2from
Closed
Fix Analyzers build race condition and sync unofficial pipeline#15183joperezr wants to merge 3 commits intomicrosoft:release/13.2from
joperezr wants to merge 3 commits intomicrosoft:release/13.2from
Conversation
The Aspire.Hosting.AppHost.csproj had a direct ProjectReference to Aspire.Hosting.Analyzers without SetTargetFramework or GlobalPropertiesToRemove. Since Directory.Build.targets also injects an analyzer reference WITH those attributes, MSBuild saw two different global-property sets and created two parallel build nodes for the same output path, causing intermittent Pdb2Pdb file-locking errors (MSB3026/CS2012) on Windows CI. This aligns the direct reference and MSBuild task call with the injected one so MSBuild deduplicates them into a single node. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…M image The unofficial pipeline was still using the now-removed windows.vs2022preview.amd64 image, causing the build stage to be skipped. Updated to match the official pipeline's image. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The unofficial pipeline was missing the Node.js, yarn, and vsce installation steps that the official pipeline has before calling the BuildAndTest template. Since BuildAndTest uses /p:BuildExtension=true, the VS Code extension build requires these tools. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15183Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15183" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses intermittent MSBuild file-locking failures involving Aspire.Hosting.Analyzers.dll by aligning the Aspire.Hosting.AppHost direct analyzer ProjectReference (and an MSBuild invocation) with the repo-wide injected analyzer reference, and it updates the unofficial Azure Pipelines definition to match current official pipeline prerequisites.
Changes:
- Align
Aspire.Hosting.AppHost’s directProjectReferencetoAspire.Hosting.AnalyzerswithSetTargetFrameworkandGlobalPropertiesToRemoveto avoid parallel builds targeting the same output. - Update the
IncludeAnalyzerInPackageMSBuild call to use consistentProperties/RemovePropertiesforGetTargetPath. - Sync unofficial pipeline VM image and add Node/yarn/vsce setup steps to match the official pipeline.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Hosting.AppHost/Aspire.Hosting.AppHost.csproj | Aligns analyzer project reference/MSBuild invocation properties to prevent duplicate build nodes and file-lock races. |
| eng/pipelines/azure-pipelines-unofficial.yml | Updates the Windows image and adds Node/yarn/vsce setup steps to keep the unofficial pipeline consistent with the official one. |
You can also share your feedback on Copilot code review. Take the survey.
Member
eerhardt
reviewed
Mar 12, 2026
Member
Author
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.
Summary
This PR fixes the intermittent
MSB3026/CS2012file-locking errors onAspire.Hosting.Analyzers.dllthat have been causing thedotnet-aspireofficial pipeline to fail on therelease/13.2branch.Root Cause
The
Aspire.Hosting.AppHost.csprojhad a directProjectReferencetoAspire.Hosting.AnalyzerswithoutSetTargetFrameworkorGlobalPropertiesToRemove. Sincesrc/Directory.Build.targetsalso injects an analyzer reference with those attributes into allAspire.Hosting.*projects, MSBuild saw two different global-property configurations and created two parallel build nodes targeting the same output path. When both nodes tried to writeAspire.Hosting.Analyzers.dllsimultaneously,Pdb2Pdbwould hold a file lock causing the second node to fail.Changes
src/Aspire.Hosting.AppHost/Aspire.Hosting.AppHost.csproj: AddedSetTargetFrameworkandGlobalPropertiesToRemoveto the directProjectReference, andProperties/RemovePropertiesto theMSBuildtask call — aligning them with the injected reference fromDirectory.Build.targetsso MSBuild deduplicates into a single node.eng/pipelines/azure-pipelines-unofficial.yml: Synced with the official pipeline:windows.vs2022preview.amd64(no longer exists) towindows.vs2026preview.scout.amd64Validation
@radical This is an attempt to fix the race conditions we've been seeing in the
dotnet-aspireofficial builds onrelease/13.2. The Analyzers DLL file-locking error has been hitting 3 out of the last 5 builds.