PowerShell / PowerShell

PowerShell for every system!
https://microsoft.com/PowerShell
MIT License
43.56k stars 7.06k forks source link

Create the Windows.x64 global tool with shim for signing #21559

Closed adityapatwardhan closed 2 weeks ago

adityapatwardhan commented 2 weeks ago

PR Summary

Fixes https://github.com/PowerShell/PowerShell/issues/20557

The global tool for Windows.x64 is created using dotnet pack so that shim can be generated during the build for signing. The tool uses a new csproj with added properties for generating the shim, we added the build to fxdependent stage.

More details about shim are documented here: https://github.com/dotnet/sdk/blob/main/documentation/general/signing-global-tool-packages.md

The way the build works is a bit tricky as when it is built, we cannot add the modules that come from gallery. We have to use dotnet pack to build the nupkg and then expand it as a zip. After expanding we restore the signed files for the modules from the gallery. We also delete content and contentFiles folder which are not necessary. After that, we repack using Compress-Archive and rename it back to a nupkg.

PR Context

dotnet-sdk images show that the exe is unsigned and fails compliance requirements.

PR Checklist