devexpress-xaf-docker
Skill4 starsChanged 6 months agoMITView on GitHub
Deploy DevExpress XAF Blazor Server apps in Docker containers and handle XAF EF Core provider gotchas. Use when building Dockerfiles for XAF, DevExpress Blazor, or any .NET app using DevExpress.Drawing.Skia/SkiaSharp in Linux containers. Also use when setting up XAF with non-SqlServer databases (PostgreSQL, MySQL, etc.) or fixing Model Editor errors. Triggers: Dockerfile for XAF, DevExpress in Docker, SkiaSharp Docker, libSkiaSharp error, libfontconfig error, XAF container, DevExpress container deployment, XAF PostgreSQL, XAF Model Editor error, SqlServer assembly not found, EFCoreProvider=Postgres.
- Deletes or force-pushes
- Installs packages
In this repository11 other files it gives its agents.
- xaf-blazor-startupSkill
- xaf-conditional-appearanceSkill
- xaf-easytest-authoringSkill
- xaf-efcore-entitiesSkill
- xaf-environment-authSkill
- xaf-hangfire-jobsSkill
- xaf-navigation-hubSkill
- xaf-playwright-testingSkill
- xaf-reportingSkill
- xaf-search-panelsSkill
- xaf-securitySkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 51
Consider automating this as an entrypoint script or init container.
- Distinctive: line 103
Fix: Add SqlServer as a dependency even though it's not used at runtime:
- Very specific: line 117
Connection string prefix: Use EFCoreProvider=Postgres so XAF auto-selects Npgsql:
- Very specific: line 122
Legacy timestamp behavior: Add before CreateHostBuilder in Program.cs:
- Very specific: line 140
Prometheus config: use host.docker.internal:<kestrel-http-port> with scheme: http.
- Distinctive: line 152
When tables are managed outside EF Core (SQL scripts, partitioned tables, etc.), XAF's schema updater will try to drop/recreate PKs and FKs …
- Very specific: line 154
Fix: Use ExcludeFromMigrations() + UpdateDatabaseAlways:
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DevExpress XAF Docker & EF Core Provider Guide
SkiaSharp Native Dependencies
The dotnet/aspnet:8.0 image lacks native libraries SkiaSharp needs. The NuGet package SkiaSharp.NativeAssets.Linux provides the managed wrapper but NOT the system dependencies.
Install in the runtime stage of the Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
RUN apt-get update && apt-get install -y --no-install-recommends \
libfontconfig1 libfreetype6 && \
rm -rf /var/lib/apt/lists/*Without this: DllNotFoundException: Unable to load shared library 'libSkiaSharp' / libfontconfig.so.1: cannot open shared object file.
SkiaSharp Version Must Match DevExpress
DevExpress.Drawing.Skia pins a specific SkiaSharp version. Mismatches cause runtime failures.
| DevExpress | SkiaSharp.NativeAssets.Linux |
| 25.2.x | 3.119.1 |
| 24.2.x | 2.88.9 |
Check with: dotnet list package --include-transitive | grep SkiaSharp
XAF Database Initialization
XAF must create its schema before serving pages. Run after container starts:
docker compose exec <service> dotnet <assembly>.dll --updateDatabase --forceUpdate --silentWithout this, XAF shows "Application Error" in the browser and any EF/SQL queries against XAF tables fail with Invalid object name.
Consider automating this as an entrypoint script or init container.
.dockerignore is Critical on Windows
Windows bin/ and obj/ directories copied into a Linux build container cause failures with --no-restore (wrong platform binaries). Always include:
bin/
obj/
.vs/
*.user
node_modules/Multi-Stage Dockerfile Pattern
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
RUN apt-get update && apt-get install -y --no-install-recommends \
libfontconfig1 libfreetype6 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
EXPOSE 5001
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY nuget.config .
COPY MyProject.Module/MyProject.Module.csproj MyProject.Module/
COPY MyProject.Blazor.Server/MyProject.Blazor.Server.csproj MyProject.Blazor.Server/
RUN dotnet restore MyProject.Blazor.Server/MyProject.Blazor.Server.csproj
COPY . .
RUN dotnet publish MyProject.Blazor.Server/MyProject.Blazor.Server.csproj -c Release -o /app/publish --no-restore
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENV ASPNETCORE_URLS=http://+:5001
ENTRYPOINT ["dotnet", "MyProject.Blazor.Server.dll"]Key points:
nuget.configcopied before restore (contains DevExpress private feed)nuget.configshould be gitignored (contains personal feed URL)- Native deps installed in base stage, inherited by final stage
--no-restorein publish since restore already ran
XAF EF Core with Non-SqlServer Databases
Model Editor Requires SqlServer Assembly
XAF's Visual Studio Model Editor uses DevExpress.ExpressApp.EFCore.DesignTime.DesignTimeDbContextCreator which always tries to load Microsoft.EntityFrameworkCore.SqlServer, even when the project uses a different provider (PostgreSQL, MySQL, etc.).
Fix: Add SqlServer as a dependency even though it's not used at runtime:
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.18" />Without this: System.TypeLoadException: Could not find assembly 'Microsoft.EntityFrameworkCore.SqlServer' when opening the Model Editor.
Note: Adding IDesignTimeDbContextFactory<TContext> does NOT help — XAF's design-time tooling ignores it and uses its own creator.
PostgreSQL Provider Setup
For XAF + EF Core + PostgreSQL:
- Connection string prefix: Use
EFCoreProvider=Postgresso XAF auto-selects Npgsql:EFCoreProvider=Postgres;Host=localhost;Port=5432;Database=mydb;Username=user;Password=pass - Legacy timestamp behavior: Add before
CreateHostBuilderin Program.cs:
Without this:AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);Cannot write DateTime with Kind=Utc to PostgreSQL type 'timestamp without time zone'. - Required packages:
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.*" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.18" />
Container-to-Host Communication
Docker containers reach the host via host.docker.internal (Docker Desktop only). Key gotchas:
- Kestrel only — IIS Express binds to
localhostand is unreachable from containers. Use the Kestrel launch profile (dotnet runor VS "Project" profile). - HTTPS redirect breaks scraping —
UseHttpsRedirection()redirects container HTTP requests to HTTPS with a dev cert the container can't verify. Exclude monitoring endpoints withapp.UseWhen()(see xaf-blazor-startup skill). - Prometheus config: use
host.docker.internal:<kestrel-http-port>withscheme: http.
XAF Does NOT Support Composite Keys with EF Core
XAF requires a single-column primary key. For databases that need composite keys (e.g., PostgreSQL partitioned tables with PRIMARY KEY (id, partition_key)):
- EF Core uses a single column (e.g.,
id BIGSERIAL) as the sole key for object identity/tracking - The database maintains the composite PK for its own purposes (partitioning, etc.)
- This works as long as the single column is globally unique (BIGSERIAL/IDENTITY)
Externally-Managed Tables (Partitioned Tables, Pre-Existing Schema)
When tables are managed outside EF Core (SQL scripts, partitioned tables, etc.), XAF's schema updater will try to drop/recreate PKs and FKs to match the EF model — which fails on partitioned tables.
Fix: Use ExcludeFromMigrations() + UpdateDatabaseAlways:
- In
OnModelCreating, exclude externally-managed tables from migrations:modelBuilder.Entity<Ticket>(b => { b.ToTable("tickets", t => t.ExcludeFromMigrations()); b.HasKey(t => t.Id); // ... other config }); - In
BlazorApplication, always run the updater (so XAF system tables get created):protected override void OnSetupStarted() { base.OnSetupStarted(); DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; }
Without ExcludeFromMigrations: cannot drop constraint X_pkey on table X because other objects depend on it.
Without UpdateDatabaseAlways: XAF system tables (security, model diffs) won't be created on first run.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

