fix(build): enable ReadyToRun and trimming only when publishing #79

Merged
KofTwentyTwo merged 1 commits from fix/publish-only-r2r into main 2026-10-10 13:06:46 +00:00
KofTwentyTwo commented 2026-10-10 13:00:58 +00:00 (Migrated from github.com)

What

The first rehearsal of the shared release workflow (v1.0.1-beta.2, run 38053540124) failed in the Release build with NETSDK1094: gclo.csproj enabled PublishReadyToRun and PublishTrimmed for every non-Debug configuration, so a plain dotnet build -c Release needed the crossgen pack, which only a restore made with that property downloads. The shared workflow restores once (no configuration) and then builds Release, and a clean runner has no cached pack.

Both properties are now publish-only ('$(_IsPublishing)' == 'true'), so the publish step's own restore fetches the pack and a Release build needs nothing extra. The published app is unchanged: ReadyToRun still applies at publish, and the shared workflow still passes -p:PublishTrimmed=false as before.

Closes #78 (part of #62; blocks #67)

How it was tested

  • With NUGET_PACKAGES pointed at an empty directory, the shared workflow's exact sequence: dotnet restore gclo.slnx -p:Platform=x64 --locked-mode, dotnet build gclo.slnx -c Release -p:Platform=x64 -warnaserror --no-restore, dotnet test gclo.Cli.Tests -c Release --no-build, then the app and CLI publishes with -p:RestoreLockedMode=true. Results in the PR comments.
  • Next rehearsal: v1.0.1-beta.3 (the beta.2 tag is spent; no release was created).

🤖 Generated with Claude Code

## What The first rehearsal of the shared release workflow (`v1.0.1-beta.2`, run 38053540124) failed in the Release build with NETSDK1094: `gclo.csproj` enabled `PublishReadyToRun` and `PublishTrimmed` for every non-Debug configuration, so a plain `dotnet build -c Release` needed the crossgen pack, which only a restore made with that property downloads. The shared workflow restores once (no configuration) and then builds Release, and a clean runner has no cached pack. Both properties are now publish-only (`'$(_IsPublishing)' == 'true'`), so the publish step's own restore fetches the pack and a Release build needs nothing extra. The published app is unchanged: ReadyToRun still applies at publish, and the shared workflow still passes `-p:PublishTrimmed=false` as before. Closes #78 (part of #62; blocks #67) ## How it was tested - With `NUGET_PACKAGES` pointed at an empty directory, the shared workflow's exact sequence: `dotnet restore gclo.slnx -p:Platform=x64 --locked-mode`, `dotnet build gclo.slnx -c Release -p:Platform=x64 -warnaserror --no-restore`, `dotnet test gclo.Cli.Tests -c Release --no-build`, then the app and CLI publishes with `-p:RestoreLockedMode=true`. Results in the PR comments. - Next rehearsal: `v1.0.1-beta.3` (the beta.2 tag is spent; no release was created). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
KofTwentyTwo commented 2026-10-10 13:01:13 +00:00 (Migrated from github.com)

Clean-cache replay of the shared workflow's sequence (NUGET_PACKAGES = empty directory), on this branch:

dotnet restore gclo.slnx -p:Platform=x64 --locked-mode                     -> exit 0
dotnet build gclo.slnx -c Release -p:Platform=x64 -warnaserror --no-restore -> Build succeeded
dotnet test gclo.Cli.Tests -c Release --no-build                           -> 129/129 passed
dotnet publish gclo/gclo.csproj -c Release -p:Platform=x64 -r win-x64 --self-contained -p:RestoreLockedMode=true -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true -p:PublishTrimmed=false -> 446 files, LICENSE included
dotnet publish gclo.Cli/gclo.Cli.csproj -c Release -r win-x64 --self-contained -p:RestoreLockedMode=true -p:PublishSingleFile=true -> gclo.exe + LICENSE
Clean-cache replay of the shared workflow's sequence (`NUGET_PACKAGES` = empty directory), on this branch: ```text dotnet restore gclo.slnx -p:Platform=x64 --locked-mode -> exit 0 dotnet build gclo.slnx -c Release -p:Platform=x64 -warnaserror --no-restore -> Build succeeded dotnet test gclo.Cli.Tests -c Release --no-build -> 129/129 passed dotnet publish gclo/gclo.csproj -c Release -p:Platform=x64 -r win-x64 --self-contained -p:RestoreLockedMode=true -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true -p:PublishTrimmed=false -> 446 files, LICENSE included dotnet publish gclo.Cli/gclo.Cli.csproj -c Release -r win-x64 --self-contained -p:RestoreLockedMode=true -p:PublishSingleFile=true -> gclo.exe + LICENSE ```
Sign in to join this conversation.