Skip to content

[release/v7.6.1] Move _GetDependencies MSBuild target from dynamic generation in build.psm1 into Microsoft.PowerShell.SDK.csproj#27177

Merged
adityapatwardhan merged 1 commit into
PowerShell:release/v7.6.1from
adityapatwardhan:backport/release/v7.6.1/27052-569eb7246
Apr 3, 2026
Merged

[release/v7.6.1] Move _GetDependencies MSBuild target from dynamic generation in build.psm1 into Microsoft.PowerShell.SDK.csproj#27177
adityapatwardhan merged 1 commit into
PowerShell:release/v7.6.1from
adityapatwardhan:backport/release/v7.6.1/27052-569eb7246

Conversation

@adityapatwardhan
Copy link
Copy Markdown
Member

Backport of #27052 to release/v7.6.1

Triggered by @adityapatwardhan on behalf of @app/copilot-swe-agent

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Ensures the SDK project carries the _GetDependencies target directly on the release/v7.6.1 branch and keeps Start-TypeGen native execution handling consistent for build tooling reliability.

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Cherry-pick applied cleanly with no merge conflicts; this backport preserves the already-validated change from main and is scoped to build/type generation plumbing in build.psm1 and Microsoft.PowerShell.SDK.csproj.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Low risk because this is a focused build-system maintenance change already merged on main, with no runtime feature behavior changes and no additional conflict resolution needed.

…ild.psm1` into `Microsoft.PowerShell.SDK.csproj` (PowerShell#27052)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@adityapatwardhan adityapatwardhan requested review from a team and jshigetomi as code owners April 2, 2026 23:41
@adityapatwardhan adityapatwardhan added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Apr 2, 2026
Copilot AI review requested due to automatic review settings April 2, 2026 23:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backports the build tooling change from #27052 to the release/v7.6.1 branch by moving the _GetDependencies MSBuild target into the SDK project file and simplifying Start-TypeGen to invoke it directly with consistent native-command error handling.

Changes:

  • Adds _GetDependencies target to Microsoft.PowerShell.SDK.csproj (previously generated dynamically during Start-TypeGen).
  • Removes dynamic .targets file creation from Start-TypeGen.
  • Wraps dotnet msbuild and dotnet run calls in Start-NativeExecution for consistent exit-code handling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj Adds the _GetDependencies target (and related guidance) directly to the project so TypeGen can query dependencies without generated targets.
build.psm1 Removes dynamic target generation and uses Start-NativeExecution around TypeGen’s dotnet invocations.

Comment thread build.psm1
try {
$ps_inc_file = "$PSScriptRoot/src/TypeCatalogGen/$IncFileName"
dotnet msbuild .\Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$ps_inc_file" /nologo
Start-NativeExecution { dotnet msbuild .\Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$ps_inc_file" /nologo }
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dotnet msbuild invocation uses a Windows-style relative path (.\Microsoft.PowerShell.SDK.csproj). This can be problematic on non-Windows agents and is inconsistent with the cross-platform ./dummy.csproj guidance added to the csproj comment. Use ./Microsoft.PowerShell.SDK.csproj (or just Microsoft.PowerShell.SDK.csproj since you’ve Push-Location’d into the directory) to keep the command line portable.

Suggested change
Start-NativeExecution { dotnet msbuild .\Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$ps_inc_file" /nologo }
Start-NativeExecution { dotnet msbuild ./Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$ps_inc_file" /nologo }

Copilot uses AI. Check for mistakes.
@adityapatwardhan adityapatwardhan merged commit 309fb4e into PowerShell:release/v7.6.1 Apr 3, 2026
43 checks passed
@adityapatwardhan adityapatwardhan deleted the backport/release/v7.6.1/27052-569eb7246 branch April 3, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants