Skip to content

Exclude build intermediates from test packages - #28325

Merged
Justin Chung (jshigetomi) merged 1 commit into
PowerShell:masterfrom
jshigetomi:jshigetomi-port-test-package-cleanup
Nov 4, 2026
Merged

Justin Chung (jshigetomi) merged 1 commit into
PowerShell:masterfrom
jshigetomi:jshigetomi-port-test-package-cleanup

Conversation

@jshigetomi

Copy link
Copy Markdown
Collaborator

PR Summary

Exclude generated obj directories after publishing PowerShell test tools so SDK build intermediates are not copied into test-package archives. Published bin outputs required to run tests remain unchanged.

PR Context

This ports commit a712d40678c02a6198d140de474a29b4a18d2845 from release/v7.7.0-rc.1 to master.

The coordinated binaries build's Guardian CodeSign validation reported CodeSign.MissingSigningCert for Microsoft.NET.Sdk.BlazorWeb.DotNetWatch.BrowserTools.Config.js files inside Windows test packages. Those files are generated by Microsoft.NET.Sdk.Web under test-tool obj directories and are not intended distribution artifacts.

Validation:

  • PASS: pwsh -NoLogo -NoProfile -Command '$parseErrors = $null; [void][System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path ".\build.psm1"), [ref]$null, [ref]$parseErrors); if ($parseErrors.Count -gt 0) { $parseErrors | ForEach-Object { Write-Error $_.Message }; exit 1 }; "PASS: build.psm1 has no PowerShell parser errors."'
  • PASS: git diff --check origin/master...HEAD

PR Checklist

…om test package

## Summary
- Remove generated `obj` directories after publishing PowerShell test tools.
- Preserve the published `bin` outputs required to run tests.
- Prevent SDK-generated build intermediates from being copied into test-package archives.

## Reason
The coordinated binaries build's Guardian CodeSign validation reported `CodeSign.MissingSigningCert` for `Microsoft.NET.Sdk.BlazorWeb.DotNetWatch.BrowserTools.Config.js` files inside the Windows test packages. Those files are generated by `Microsoft.NET.Sdk.Web` under test-tool `obj` directories and are not intended distribution artifacts.

This cleanup is in `Publish-PSTestTools`, so it covers both `New-TestPackage` and `Compress-TestContent` consumers.

Related build: https://dev.azure.com/mscodehub/PowerShellCore/_build/results?buildId=733320

## Validation
- `build.psm1` parses with no PowerShell parser errors.
- `git diff --check` passes.
- The change is limited to four lines in `build.psm1`.

----
#### AI description  (iteration 1)
#### PR Classification
Build process cleanup: removes unnecessary build intermediates from test packages.

#### PR Summary
This PR updates `build.psm1` to remove `obj` directories from the test folder during test tool publishing, ensuring build intermediates are excluded from test packages.
- `build.psm1`: Added logic to `Publish-PSTestTools` function to recursively find and delete `obj` directories under `$PSScriptRoot/test` before completing the test package publishing process.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
@jshigetomi
Justin Chung (jshigetomi) requested a review from a team as a code owner November 4, 2026 03:21
Copilot AI balanced review requested due to automatic review settings November 4, 2026 03:21
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the post-publish cleanup of generated test-tree obj directories.

No open issues 🎉

What changed in this PR

Exclude generated build intermediates from PowerShell test packages to address signing-validation failures caused by SDK-generated files.

Changes:

  • Remove obj directories under test after publishing test tools and the custom connection module.
  • Leave published bin outputs needed to run tests unchanged.
File Description
build.psm1 Add post-publish cleanup of test-tree obj directories in Publish-PSTestTools.

Review effort: Balanced

@jshigetomi Justin Chung (jshigetomi) added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Nov 4, 2026
@jshigetomi
Justin Chung (jshigetomi) merged commit ab8b508 into PowerShell:master Nov 4, 2026
44 of 45 checks passed
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.

3 participants