Pre-generate API reference pages before dotnet publish

MSBuild evaluates **/*.razor globs at project evaluation time, before
targets run. The GenerateApiPages target creates .razor files too late
for them to be compiled on a clean build, resulting in a 13KB DLL with
no pages instead of 27MB. Fix by running the generator in a separate
step so files exist on disk before publish.
This commit is contained in:
Atanas Korchev
2026-03-12 14:48:01 +02:00
parent 7648a0cfd6
commit 854f9a81b5

View File

@@ -20,11 +20,16 @@ RUN dotnet restore RadzenBlazorDemos.Host/RadzenBlazorDemos.Host.csproj \
# Copy full source after restore layer # Copy full source after restore layer
COPY . . COPY . .
# Publish the Blazor host app (API reference pages are generated at build time via MSBuild target) # Pre-generate API reference pages (must exist on disk before publish evaluates globs)
RUN dotnet build Radzen.Blazor/Radzen.Blazor.csproj -c Release \
&& dotnet run --project Radzen.Blazor.Api.Generator -- \
Radzen.Blazor/bin/Release/net10.0/Radzen.Blazor.dll \
Radzen.Blazor/bin/Release/net10.0/Radzen.Blazor.xml \
Radzen.Blazor.Api/Generated/Pages
# Publish the Blazor host app (generated pages are now on disk for the SDK to discover)
WORKDIR /src/RadzenBlazorDemos.Host WORKDIR /src/RadzenBlazorDemos.Host
RUN dotnet publish -c Release -o /app/out \ RUN dotnet publish -c Release -o /app/out
&& test -f /app/out/Radzen.Blazor.Api.dll \
&& echo "API reference assembly found in publish output"
# ============================= # =============================