Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TravisEz13
Copy link
Member

Backport of #25837 to release/v7.5

Triggered by @TravisEz13 on behalf of @jshigetomi

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

Tooling Impact

  • Required tooling change

This backports build system improvements that specify .NET search behavior by build type (FxDependent, FxDependentDeployment, SelfContained). This is a prerequisite for PR #26290 which enables ready-to-run compilation only for Release configuration.

Regression

  • No

This is a build infrastructure improvement that adds more granular control over AppHostDotNetSearch and PublishReadyToRun settings based on deployment type.

Testing

Verified by:

  1. Cherry-pick applied cleanly to release/v7.5
  2. Changes limited to build configuration files (PowerShell.Common.props and build.psm1)
  3. Original PR was tested and merged to main branch

This change enables proper deployment-specific configuration for framework-dependent and self-contained builds.

Risk

  • High
  • Medium
  • Low

Medium risk: Changes build configuration properties that affect how PowerShell binaries are packaged and deployed. However, this is necessary infrastructure for enabling ready-to-run improvements (PR #26290) and has been validated in the main branch. The changes provide more explicit control over build behavior rather than changing existing functionality.

Co-authored-by: Travis Plunk (HE/HIM) <[email protected]>
Co-authored-by: Travis Plunk <[email protected]>
@TravisEz13 TravisEz13 requested a review from a team as a code owner November 9, 2025 02:45
Copilot AI review requested due to automatic review settings November 9, 2025 02:45
@TravisEz13 TravisEz13 added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Nov 9, 2025
Copy link
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

This PR refactors the build system to use a centralized AppDeployment property to control deployment-specific settings, replacing the previous approach of directly overriding PublishReadyToRun in the build script. The change moves the responsibility of setting deployment-specific MSBuild properties (like AppHostDotNetSearch) from build.psm1 to PowerShell.Common.props.

  • Introduces AppDeployment property with three values: FxDependent, FxDependentDeployment, and SelfContained
  • Replaces direct PublishReadyToRun override with conditional logic based on AppDeployment type
  • Adds AppHostDotNetSearch configuration in PowerShell.Common.props for different deployment scenarios

Reviewed Changes

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

File Description
build.psm1 Replaces direct PublishReadyToRun property override with AppDeployment property that gets passed to MSBuild, determining deployment type based on runtime and ForMinimalSize flag
PowerShell.Common.props Adds three PropertyGroup sections that configure AppHostDotNetSearch based on AppDeployment value, controlling where the .NET runtime searches for the apphost

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</PropertyGroup>

<PropertyGroup Condition=" '$(AppDeployment)' == 'FxDependentDeployment' ">
<!-- If we specify Environment too, it searches that first, no matter what order we specify-->
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

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

Comment uses 'Environment' as shorthand for 'EnvironmentVariable'. For consistency with line 188 which uses the full property name 'EnvironmentVariable', the comment should use 'EnvironmentVariable' instead of 'Environment'.

Suggested change
<!-- If we specify Environment too, it searches that first, no matter what order we specify-->
<!-- If we specify EnvironmentVariable too, it searches that first, no matter what order we specify-->

Copilot uses AI. Check for mistakes.

<!-- Define properties for Framework dependent deployments in Packages
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#apphostdotnetsearch
For FxDependent, we want to search for the apphost in the Environment or global location,
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

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

Comment uses 'Environment' as shorthand but line 188 sets the actual property value to 'EnvironmentVariable'. For clarity and consistency, the comment should use 'EnvironmentVariable' to match the actual property value.

Suggested change
For FxDependent, we want to search for the apphost in the Environment or global location,
For FxDependent, we want to search for the apphost in the EnvironmentVariable or global location,

Copilot uses AI. Check for mistakes.
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Nov 16, 2025
@microsoft-github-policy-service
Copy link
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

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 Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants