fix(worker): package the preview script reliably on an incremental publish

The .NET 10 SDK cleans the publish directory, and an incremental build
then skips copying content into it — so a second publish produced a
package with the exe but no scripts\vfxr_build_preview.jsx. The exe loads
that script from its own folder at runtime, so the package would have
installed cleanly and failed every preview job.

The Content item now sets CopyToPublishDirectory explicitly
(CopyToOutputDirectory only governs the build folder), and publish.ps1
copies the script itself rather than trusting the SDK, keeping the
existing verification as the backstop that caught this.

Verified by publishing twice in a row: the incremental second run, which
previously failed, now produces a complete package and zip.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-08-13 15:19:47 +02:00
parent a4f8226f3f
commit ca9a004d56
3 changed files with 17 additions and 2 deletions
@@ -28,9 +28,16 @@
</ItemGroup>
<ItemGroup>
<!-- Headless AE build script ships beside the exe -->
<!--
Headless AE build script ships beside the exe. CopyToPublishDirectory is
set explicitly: CopyToOutputDirectory alone governs the build folder, and
an incremental publish then leaves the script out of a freshly-cleaned
publish directory. publish.ps1 copies it again and verifies, because the
exe cannot run a preview job without it.
-->
<Content Include="..\scripts\vfxr_build_preview.jsx" Link="scripts\vfxr_build_preview.jsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
</ItemGroup>
Binary file not shown.
+9 -1
View File
@@ -38,8 +38,16 @@ if ($sha) { $publishArgs += "-p:SourceRevisionId=$sha" }
& dotnet publish @publishArgs
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" }
# The exe reads scripts\vfxr_build_preview.jsx from its own folder at runtime.
# The exe reads scripts\vfxr_build_preview.jsx from its own folder at runtime,
# so it is copied here unconditionally rather than trusted to the SDK: an
# incremental publish into a cleaned output directory silently skips content
# copying, which produced a package that looked fine and could not build a
# preview. Copy, then verify.
$scriptSrc = Join-Path $PSScriptRoot "vfxr_build_preview.jsx"
$scriptOut = Join-Path $OutDir "scripts\vfxr_build_preview.jsx"
if (-not (Test-Path $scriptSrc)) { throw "Preview build script not found in source: $scriptSrc" }
New-Item -ItemType Directory -Force (Split-Path $scriptOut) | Out-Null
Copy-Item $scriptSrc $scriptOut -Force
if (-not (Test-Path $scriptOut)) { throw "Preview build script missing from output: $scriptOut" }
Remove-Item (Join-Path $OutDir "*.pdb") -ErrorAction SilentlyContinue