GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Build self-contained minimal size package for Guest Config team by daxian-dbw · Pull Request #14976 · PowerShell/PowerShell

Conversation

@daxian-dbw

@daxian-dbw Dongbo Wang (daxian-dbw) commented Mar 9, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Summary

This PR includes changes in Build.psm1, packaging.psm1 and the release build template files.

  • For Build.psm1, -ForMinimalSize is added to Start-PSBuild to build self-contained application for "linux-x64", "win7-x64", or "osx-x64" runtimes. It reduces the size of package by:

    • Avoid CrossGen PowerShell and all other library assemblies.
    • Not include the Graphical Host and the WPF/WinForm stuff it pulls in.
    • Remove symbol files (.pdb) and XML document files (.xml)
  • For packaging.psm1, min-size is added as a new value for -Type parameter of Start-PSPackage.

  • For Windows release build, a new build configuration minSize is added, to build and packaging the min-size package.
    For Linux release build, -TarMinSize is added to PowerShellPackage.ps1 as well as build.json to build and package for the min-size package.

The min-size package has the -gc suffix to indicate that it's for the Guest Config team. In the Azure Blob, the min-size packages are uploaded to the container with the -gc suffix, not in the main package maintainer (e.g. v7-2-0-preview-4), so that they don't get uploaded to the GitHub release page.

Here is the release build run: https://dev.azure.com/mscodehub/PowerShellCore/_build/results?buildId=175764&view=results

The package size is reduced:

  • Windows (x64-zip): from 97mb to 45.3mb
  • Linux (x64-tar.gz): from 63.4mb to 40.6mb

PR Context

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • Breaking changes
    • None
    • OR
    • Experimental feature(s) needed
      • Experimental feature name(s):
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
  • Tooling
    • I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@daxian-dbw
Dongbo Wang (daxian-dbw) requested review from Travis Plunk (TravisEz13), Aditya Patwardhan (adityapatwardhan), Andrew (anmenaga) and Rob Holt (rjmholt) March 9, 2021 00:17
@ghost ghost assigned Andrew (anmenaga) Mar 9, 2021
@adityapatwardhan

Aditya Patwardhan (adityapatwardhan) commented Mar 9, 2021

Copy link
Copy Markdown
Member

Dongbo Wang (@daxian-dbw) - seems like there are some merge conflicts. please have a look.

daxian-dbw reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Dongbo Wang (daxian-dbw) added 20 commits March 8, 2021 16:36
@daxian-dbw
Avoid CrossGen and exclude GraphicHost from the build
b5ab2ae
@daxian-dbw
Remove .pdb, .xml files; also remove the PSMaml schemas
204bb25
@daxian-dbw
Integrate the min-size package to release build
c5751fc
@daxian-dbw
Fix 'BuildConfiguration' name
6d7e5d6
@daxian-dbw
Fix errors
f0092cb
@daxian-dbw
Fix another error
e2c0912
@daxian-dbw
Attempt to fix build
5c73fe3
@daxian-dbw
Fix build break
29b36fa
@daxian-dbw
Update file.wxs
aacbc71
@daxian-dbw
Fix another build error
68b953a
@daxian-dbw
Build min-size package for Linux
fd7ff3d
@daxian-dbw
Upload the min-size package to separate container in Azure blob
6cde2f4
@daxian-dbw
Do not upload min-size package to the main Az blob container
40c2702
@daxian-dbw
Fix a typo
e7d6218
@daxian-dbw
Updated linux.yml
5fa96ae
@daxian-dbw
Fix the parsing error
290f88f
@daxian-dbw
Fix the variable name
0f439d7
@daxian-dbw
Fix min-size build for Linux
9c54468
@daxian-dbw
Attempt to fix the linux min-size build
3c8805d
@daxian-dbw
Update the log messages
7bb5ba2
rjmholt
Rob Holt (rjmholt) reviewed Mar 9, 2021
View reviewed changes
Comment thread build.psm1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/packaging/packaging.psm1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 Outdated

@rjmholt Rob Holt (rjmholt) Mar 9, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Where does this get used?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@daxian-dbw Dongbo Wang (daxian-dbw) Mar 9, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm not sure. This was existing code, see below:

PowerShell/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1

Lines 173 to 186 in 877c97f

Write-Verbose "Exporting project.assets files ..." -Verbose
$projectAssetsCounter = 1
$projectAssetsFolder = Join-Path -Path $destination -ChildPath 'projectAssets'
$projectAssetsZip = Join-Path -Path $destination -ChildPath 'windowsProjectAssetssymbols.zip'
Get-ChildItem $location\project.assets.json -Recurse | ForEach-Object {
$subfolder = $_.FullName.Replace($location,'')
$subfolder.Replace('project.assets.json','')
$itemDestination = Join-Path -Path $projectAssetsFolder -ChildPath $subfolder
New-Item -Path $itemDestination -ItemType Directory -Force
$file = $_.FullName
Write-Verbose "Copying $file to $itemDestination" -Verbose
Copy-Item -Path $file -Destination "$itemDestination\" -Force
$projectAssetsCounter++

Travis Plunk (@TravisEz13), shall we remove $projectAssetsCounter?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rjmholt reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@daxian-dbw
Dongbo Wang (daxian-dbw) force-pushed the size branch from d2b0cc2 to 7bb5ba2 Compare March 9, 2021 00:45
adityapatwardhan
Aditya Patwardhan (adityapatwardhan) reviewed Mar 9, 2021
View reviewed changes
Comment thread build.psm1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread global.json Outdated

@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Mar 9, 2021

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This should not change in this PR right?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@daxian-dbw Dongbo Wang (daxian-dbw) Mar 9, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The 21104.4 is not the official .NET 6 preview.1 SDK version. The nuget package versions are all correct, so this is the only place we need to change to make it use the official 6-preview.1 sdk.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adityapatwardhan reacted with laugh emoji
All reactions
  • 😄 1 reaction
Comment thread tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/releaseBuild/Images/microsoft_powershell_windowsservercore/PowerShellPackage.ps1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

adityapatwardhan
Aditya Patwardhan (adityapatwardhan) reviewed Mar 9, 2021
View reviewed changes
Comment thread assets/wix/files.wxs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kilasuit

Ryan Yates (kilasuit) commented Mar 9, 2021

Copy link
Copy Markdown
Collaborator

Would this PR address this issue #5681 ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw
Address comments
a8ed57d
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Mar 9, 2021

Copy link
Copy Markdown
Member Author

Ryan Yates (@kilasuit) This is considered to be one step toward that goal, but doesn't resolve that issue. This package is produced mainly for using PowerShell in a service, where startup perf is not a concern (thus no R2R/Crossgen) and GUI won't work (thus no WPF/WinForm).

kilasuit reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Mar 9, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Aditya Patwardhan (@adityapatwardhan) and Rob Holt (@rjmholt) Thanks for the review! I have addressed or replied to your comments, please take another look.

Here is the new release build run: https://dev.azure.com/mscodehub/PowerShellCore/_build/results?buildId=175764&view=results

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rjmholt
Rob Holt (rjmholt) approved these changes Mar 9, 2021
View reviewed changes
TravisEz13
Travis Plunk (TravisEz13) reviewed Mar 9, 2021
View reviewed changes
Comment thread tools/releaseBuild/azureDevOps/templates/upload.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13
Travis Plunk (TravisEz13) approved these changes Mar 9, 2021
View reviewed changes
@daxian-dbw
Address more feedback
3335d09
@iSazonov

Ilya (iSazonov) commented Mar 11, 2021

Copy link
Copy Markdown
Collaborator

Avoid CrossGen PowerShell and all other library assemblies.

After that why do you build self-contained application? With shared framework you could significantly reduce a size of the packages.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) reviewed Mar 11, 2021
View reviewed changes
Comment thread tools/packaging/packaging.psm1 Resolved

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Mar 11, 2021

Copy link
Copy Markdown
Member Author

After that why do you build self-contained application? With shared framework you could significantly reduce a size of the packages.

This is a requirement from the Azure Guest Configuration service. There is no shared framework available and the service depends on PS package to bring in the .NET runtime.
For scenarios that have the shared framework available, the existing fx-depended packages can meet the needs.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13
Travis Plunk (TravisEz13) approved these changes Mar 11, 2021
View reviewed changes
@anmenaga

Andrew (anmenaga) commented Mar 12, 2021

Copy link
Copy Markdown

Aditya Patwardhan (@adityapatwardhan) please take another look; thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adityapatwardhan
Aditya Patwardhan (adityapatwardhan) approved these changes Mar 12, 2021
View reviewed changes
@anmenaga Andrew (anmenaga) added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Mar 12, 2021
@anmenaga
Andrew (anmenaga) merged commit b636396 into PowerShell:master Mar 12, 2021
@daxian-dbw
Dongbo Wang (daxian-dbw) deleted the size branch March 15, 2021 22:53
@ghost

Deleted user (ghost) commented Mar 16, 2021

Copy link
Copy Markdown

🎉v7.2.0-preview.4 has been released which incorporates this pull request.:tada:

Handy links:

  • Release Notes
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@daxian-dbw
Build self-contained minimal size package for Guest Config team (Powe…
0c75d1d
…rShell#14976)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@TravisEz13 Travis Plunk (TravisEz13) TravisEz13 approved these changes
@iSazonov Ilya (iSazonov) iSazonov left review comments
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) adityapatwardhan approved these changes
@anmenaga Andrew (anmenaga) Awaiting requested review from anmenaga
+1 more reviewer
@rjmholt Rob Holt (rjmholt) rjmholt approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@anmenaga Andrew (anmenaga)

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@daxian-dbw @adityapatwardhan @kilasuit @iSazonov @anmenaga @rjmholt @TravisEz13
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.