Skip to content

Fix screenplay generate in published builds - #58

Merged
woksin merged 2 commits into
mainfrom
fix/screenplay-generate-shipped-builds
Jul 30, 2026
Merged

Fix screenplay generate in published builds#58
woksin merged 2 commits into
mainfrom
fix/screenplay-generate-shipped-builds

Conversation

@woksin

@woksin woksin commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

cratis screenplay generate could not run in any shipped build — only when built from source.

Fixed

  • cratis screenplay generate failing with Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces', on both the dotnet tool package and the native downloads.
  • cratis screenplay generate failing with The build host could not be found on the native Homebrew and release downloads.

woksin and others added 2 commits July 30, 2026 21:19
The repository-wide Workspaces.Common reference carries PrivateAssets="All",
inherited from the Chronicle extraction where it existed only to support the
analyzers. That metadata still copies the assembly on build but excludes it
from publish, so every shipped artifact - the dotnet tool package as much as
the native Homebrew downloads - was missing Microsoft.CodeAnalysis.Workspaces
while a developer machine had it. 'cratis screenplay generate' failed on the
first assembly load and nothing in the repository could catch it.

Screenplay made the assembly a genuine runtime dependency, so override the
inherited default for this project.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNSXxJz2S2SxP3piPPVK4K
Roslyn evaluates MSBuild in a separate BuildHost process that it starts from
real files in a BuildHost-netcore folder beside the executable. PublishSingleFile
pulled those assemblies into the bundle, leaving the folder holding nothing
runnable, so the native downloads failed with the build host missing as soon as
the assembly it needed first was available to load.

Self-extraction puts them back on disk at startup and keeps the single binary
the release tarballs and the Homebrew formula are built around, so neither the
publish workflow nor the formula has to change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNSXxJz2S2SxP3piPPVK4K
@woksin woksin added the patch label Jul 30, 2026
@woksin

woksin commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewer context.

Root causes — two independent packaging defects, both invisible to a build from source:

  1. Directory.Build.props carries a repo-wide Microsoft.CodeAnalysis.Workspaces.Common reference with PrivateAssets="All", inherited from the Chronicle extraction where it only supported the analyzers. That metadata still copies the assembly on build but excludes it from publish — so bin/Release/net10.0 had it and every published artifact did not. Overridden per-project with PackageReference Update ... PrivateAssets="none".
  2. Roslyn 5.x evaluates MSBuild in an out-of-process BuildHost started from real files in BuildHost-netcore/. PublishSingleFile pulled those into the bundle, leaving only a stray .pdb behind. IncludeAllContentForSelfExtract restores them at startup and keeps the single-binary shape, so neither publish-native.yml nor the Homebrew formula needs to change.

Verification

  • dotnet build -c Release — 0 warnings, 0 errors; dotnet test — 551 passed
  • Published with the exact publish-native.yml command, packaged with the exact tar -czf … cratis line, extracted to a clean directory, and run from there
  • Generated a document from a restored project: exit 0, and byte-identical to the same command run by the unaffected from-source build
  • Confirmed the framework-dependent publish (the dotnet tool shape) was affected by defect 1 and is fixed

Not addressed — this does not touch #50. That issue proposes replacing MSBuildWorkspace hosting altogether, and anticipated this class of hazard in single-file native builds; this PR is the narrower packaging fix and leaves the hosting decision open.

@woksin
woksin merged commit 0aed968 into main Jul 30, 2026
1 check passed
@woksin
woksin deleted the fix/screenplay-generate-shipped-builds branch July 30, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant