Skip to content

Fix variable scope for latest MSBuild path#5559

Open
matt-edmondson wants to merge 2 commits into
microsoft:masterfrom
matt-edmondson:fix/5558-Add-MSBuildCapabilities-shadowing
Open

Fix variable scope for latest MSBuild path#5559
matt-edmondson wants to merge 2 commits into
microsoft:masterfrom
matt-edmondson:fix/5558-Add-MSBuildCapabilities-shadowing

Conversation

@matt-edmondson
Copy link
Copy Markdown

Fixes #5558 by allowing the path of the latest installed msbuild version to persist outside of the function scope

Context

Issue #5558 - A variable inside a powershell function was incorrectly scoped, causing mutations to be lost at the end of the function, and the value in the parent scope to be stale.


Description

Provide a concise summary of the changes introduced in this PR.


Risk Assessment (Low / Medium / High)

Low


Unit Tests Added or Updated (Yes / No)

No


Additional Testing Performed

Confirmed fixed on live agents


Change Behind Feature Flag (Yes / No)

N/A


Tech Design / Approach

N/A


Documentation Changes Required (Yes/No)

N/A


Logging Added/Updated (Yes/No)

N/A


Telemetry Added/Updated (Yes/No)

N/A


Rollback Scenario and Process (Yes/No)

N/A


Dependency Impact Assessed and Regression Tested (Yes/No)

N/A

Fixes microsoft#5558 by allowing the path of the latest installed msbuild version to persist outside of the function scope
@matt-edmondson matt-edmondson requested review from a team as code owners May 11, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Add-MSBuildCapabilities.ps1: MSBuild capability for v16/v17 gets clobbered when a prior version is present and v18 is not present

1 participant