Files
radzen-blazor/Dockerfile
Vladimir Enchev 1fac64e573 .NET 11 support added and .NET 8 support removed. Radzen.Blazor now targets net9.0, net10.0 and net11.0 with 11.*-* Components references, and the Sass, MoveCss and MinifyJs targets key on net11.0; the test, demo, API, tools and trimming projects, the Dockerfile images, the CI, deploy and NuGet workflows and the e2e docs moved to net11.0. The always-true NET6_0_OR_GREATER and NET8_0_OR_GREATER conditionals were collapsed. EditContext.Validate is obsolete in .NET 11, so RadzenTemplateForm, RadzenSteps and RadzenDataGrid.UpdateRow await ValidateAsync on net11.0, and the demo host dropped the obsolete UseWebAssemblyDebugging call with its inspectUri launch entries. The new .NET 11 analyzers are fixed rather than suppressed: CA1307 call sites pass StringComparison.Ordinal with the net11-only char overloads polyfilled for net9 and net10 in StringComparisonExtensions, CA1860 Any() calls compare Count or Length, CA2263 uses a GetJsonTypeInfo<T> helper that takes the generic GetTypeInfo overload on net11, and BL0012 removed seventeen StateHasChanged calls from private event handlers that ComponentBase already renders after. BL0016 (unguarded JS interop) stays in NoWarn because it accepts only a try/catch around each of 272 interop calls. The tests moved to bUnit 2.13.3, which drives the .NET 11 Virtualize component natively, behind a compatibility layer so the test sources stay as they are on master: Radzen.Blazor.Tests.TestContext derives from BunitContext and keeps RenderComponent, the ComponentParameter.CreateParameter overload and a synchronous DisposeComponents, extension methods keep SetParametersAndRender and ToMarkup, and global using aliases map TestContext, ComponentParameter and IRenderedFragment for every test namespace, so tests written against either bUnit version compile unchanged and merges from master carry no test churn. The real .NET 11 changes in the tests are a handful: EditContext.Validate is obsolete so the DataAnnotationValidator tests await ValidateAsync, AIChatService.TryQueueMessageAsync became virtual so the fake overrides it, xunit moved to 2.4.2 and its NotNull annotations make two Assert.Equal(float, float, int) calls name the precision argument and two Markdown update asserts check for null first, and CS8632 is silenced in the project because the annotations in test files without a nullable context are harmless. The chart tick label expectation follows the exact double-to-decimal conversion in .NET 11. Verified with the full suite on net11.0, the trimmed runtime gate and Playwright against the demo app for the components whose StateHasChanged calls were removed.
2026-11-09 14:16:17 +02:00

57 lines
2.4 KiB
Docker

# =============================
# BUILD STAGE
# =============================
FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build
WORKDIR /src
# The SDK image sets NUGET_XMLDOC_MODE=skip; the API page generator needs Radzen.Blazor.xml from the
# restored package, so re-enable XML doc extraction during restore.
ENV NUGET_XMLDOC_MODE=none
# Copy project files first for better caching
COPY Radzen.Blazor/*.csproj Radzen.Blazor/
COPY Radzen.Blazor.Api/*.csproj Radzen.Blazor.Api/
COPY Radzen.Blazor.Api.Generator/*.csproj Radzen.Blazor.Api.Generator/
COPY RadzenBlazorDemos/*.csproj RadzenBlazorDemos/
COPY RadzenBlazorDemos.Host/*.csproj RadzenBlazorDemos.Host/
COPY RadzenBlazorDemos.Tools/*.csproj RadzenBlazorDemos.Tools/
# Restore for Release so the Radzen.Blazor NuGet package (referenced only in Release) is downloaded
# for both the publish below and the API page generator.
RUN dotnet restore RadzenBlazorDemos.Host/RadzenBlazorDemos.Host.csproj -p:Configuration=Release \
&& dotnet restore RadzenBlazorDemos.Tools/RadzenBlazorDemos.Tools.csproj \
&& dotnet restore Radzen.Blazor.Api.Generator/Radzen.Blazor.Api.Generator.csproj
# Copy full source after restore layer
COPY . .
# Pre-generate API reference pages (and their markdown twins) from the published Radzen.Blazor package - the
# deployed site uses that same package, so there is no need to compile Radzen.Blazor (and its Sass/JS assets)
# from source. Pages must exist on disk before publish evaluates the Api project's Razor globs, and the markdown
# twins must exist before the Release build of RadzenBlazorDemos generates llms.txt and the demo twins.
RUN RADZEN_DLL=$(find /root/.nuget/packages/radzen.blazor -path '*/lib/net11.0/Radzen.Blazor.dll' | sort -V | tail -1) \
&& test -n "$RADZEN_DLL" \
&& dotnet run --project Radzen.Blazor.Api.Generator -- \
"$RADZEN_DLL" "${RADZEN_DLL%.dll}.xml" \
Radzen.Blazor.Api/Generated/Pages \
RadzenBlazorDemos.Host/wwwroot/md
# Publish the Blazor host app (generated pages are now on disk for the SDK to discover)
WORKDIR /src/RadzenBlazorDemos.Host
RUN dotnet publish -c Release -o /app/out
# =============================
# RUNTIME STAGE
# =============================
FROM mcr.microsoft.com/dotnet/aspnet:11.0 AS runtime
WORKDIR /app
# Copy only published output
COPY --from=build /app/out ./
# Set runtime URL
ENV ASPNETCORE_URLS=http://+:5000
ENTRYPOINT ["dotnet", "RadzenBlazorDemos.Host.dll"]