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

## 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)

Signed-off-by: James Maes <james@kof22.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit was merged in pull request #79.
This commit is contained in:
james.maesandClaude Fable 5.1 authored and GitHub committed 2026-10-10 08:06:45 -05:00
1 parent 987762295d
commit 3f05d541d2
1 file changed
+9 -6
+9 -6
View File
@@ -66,11 +66,14 @@
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
<!--
Publish-only properties. A plain Release build must not depend on the ReadyToRun
(crossgen) and trimming packs: only a publish-time restore downloads them, and the
release workflow restores once without a configuration, then builds Release
(NETSDK1094 otherwise). `_IsPublishing` is set by `dotnet publish`.
-->
<PropertyGroup Condition="'$(_IsPublishing)' == 'true' And '$(Configuration)' != 'Debug'">
<PublishReadyToRun>True</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
</Project>