xaf-deployment
XAF: Deployment
Blazor App Deployment
IIS
<!-- web.config (auto-generated on publish) -->
<system.webServer>
<aspNetCore processPath="dotnet"
arguments=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>
</system.webServer>
Steps:
- Publish:
dotnet publish -c Release -o ./publish - Create IIS App Pool → .NET CLR version: No Managed Code, Pipeline: Integrated
- Set physical path to publish folder
- Install ASP.NET Core Hosting Bundle
- Ensure
ASPNETCORE_ENVIRONMENT=Productionin IIS env vars
Azure App Service
# Publish from CLI
dotnet publish -c Release -o ./publish
az webapp deploy --resource-group MyRG --name MyXafApp --src-path ./publish
Connection strings in Azure App Service:
Set via Portal → App Service → Configuration → Connection strings (or Environment Variables):
ConnectionStrings__Default=Server=myserver.database.windows.net;Database=MyDb;User Id=...;Password=...;
Or in appsettings.Production.json:
{
"ConnectionStrings": {
"Default": "Server=myserver.database.windows.net;Database=MyDb;..."
}
}
DevExpress license in Azure:
DEVEXPRESS_LICENSE_KEY=<your-license-key>
(Set as Application Setting in Azure Portal)
Docker
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["MyApp.Blazor/MyApp.Blazor.csproj", "MyApp.Blazor/"]
COPY ["MyApp.Module/MyApp.Module.csproj", "MyApp.Module/"]
RUN dotnet restore "MyApp.Blazor/MyApp.Blazor.csproj"
COPY . .
RUN dotnet build "MyApp.Blazor/MyApp.Blazor.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MyApp.Blazor/MyApp.Blazor.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY /app/publish .
ENTRYPOINT ["dotnet", "MyApp.Blazor.dll"]
# docker-compose.yml
services:
app:
image: myxafapp
build: .
ports:
- "8080:8080"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ConnectionStrings__Default=Server=db;Database=MyApp;...
- DEVEXPRESS_LICENSE_KEY=${DEVEXPRESS_LICENSE_KEY}
db:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=MyPassword123!
WinForms Deployment
ClickOnce
<!-- In .csproj -->
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<BootstrapperEnabled>true</BootstrapperEnabled>
dotnet publish -c Release /p:PublishProfile=ClickOnce
MSI Installer (WiX / Visual Studio Setup Project)
- Add Setup Project to solution
- Add project output of WinForms project
- Add prerequisites: .NET Runtime, DevExpress redistributables
- Build → produces
.msi
Database Initialization
Auto-migration on startup (Development)
// In WinApplication / BlazorApplication
DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
Production — controlled migration
// Handle DatabaseVersionMismatch to control when migration runs
application.DatabaseVersionMismatch += (s, e) => {
if (IsProductionSafeToMigrate()) {
e.Updater.Update();
e.Handled = true;
}
else {
MessageBox.Show("Database requires migration. Contact administrator.");
e.Handled = true;
}
};
EF Core — run migrations on startup
// In Program.cs (Blazor) before app.Run():
using (var scope = app.Services.CreateScope()) {
var factory = scope.ServiceProvider.GetRequiredService<IDbContextFactory<ApplicationDbContext>>();
using var ctx = factory.CreateDbContext();
ctx.Database.Migrate();
}
Connection Strings
appsettings.json (EF Core)
{
"ConnectionStrings": {
"Default": "Server=(localdb)\\mssqllocaldb;Database=MyApp;Trusted_Connection=True;"
}
}
appsettings.json (XPO)
{
"ConnectionStrings": {
"Default": "XpoProvider=MSSqlServer;data source=(localdb)\\mssqllocaldb;initial catalog=MyApp;integrated security=True;"
}
}
Multiple environments
// appsettings.Development.json
{ "ConnectionStrings": { "Default": "Server=(localdb)..." } }
// appsettings.Production.json
{ "ConnectionStrings": { "Default": "Server=prod-server..." } }
Set environment: ASPNETCORE_ENVIRONMENT=Production (env var or launchSettings.json)
DevExpress License Deployment
# Environment variable (recommended for CI/CD and containers)
DEVEXPRESS_LICENSE_KEY=your-devexpress-license-key
# Or file-based: %APPDATA%\DevExpress\license.key (Windows)
# Or: ~/.config/DevExpress/license.key (Linux/macOS)
Get your license key from DevExpress Customer Center.
In CI/CD (GitHub Actions example):
env:
DEVEXPRESS_LICENSE_KEY: ${{ secrets.DEVEXPRESS_LICENSE_KEY }}
Logging (Serilog)
// Install: Serilog.AspNetCore, Serilog.Sinks.File, Serilog.Sinks.Console
builder.Host.UseSerilog((ctx, lc) => lc
.WriteTo.Console()
.WriteTo.File("logs/xaf-.log", rollingInterval: RollingInterval.Day)
.ReadFrom.Configuration(ctx.Configuration));
// XAF uses ILogger<T> internally — logs to Serilog automatically
// Log from your own code:
public class MyController : ViewController {
readonly ILogger<MyController> _logger;
[ActivatorUtilitiesConstructor]
public MyController(ILogger<MyController> logger) : base() {
_logger = logger;
}
protected override void OnActivated() {
base.OnActivated();
_logger.LogInformation("Controller activated for view {ViewId}", View?.Id);
}
}
ASP.NET Health Checks
// Add health checks
builder.Services.AddHealthChecks()
.AddDbContextCheck<ApplicationDbContext>("database")
.AddCheck("xaf", () => {
// Custom XAF health check
return HealthCheckResult.Healthy("XAF running");
});
// Map health check endpoint
app.MapHealthChecks("/health");
app.MapHealthChecks("/health/ready", new HealthCheckOptions {
Predicate = check => check.Tags.Contains("ready")
});
Environment Configuration Checklist
| Setting | Development | Production |
|---|---|---|
DatabaseUpdateMode |
UpdateDatabaseAlways |
Never or controlled |
ASPNETCORE_ENVIRONMENT |
Development |
Production |
| Connection string | localdb / dev server | prod server |
| License key | from file | env var / secret |
| Logging level | Debug | Warning/Error |
| HTTPS | optional | required |
| HSTS | disabled | enabled |
Source Links
- Deployment: https://docs.devexpress.com/eXpressAppFramework/113449/deployment
- Azure Deployment: https://docs.devexpress.com/eXpressAppFramework/113449/deployment/deployment-to-azure
- DevExpress License: https://docs.devexpress.com/eXpressAppFramework/403430/deployment/devexpress-license
- IIS Deployment (MS Docs): https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/
- Docker (MS Docs): https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/
More from kashiash/xaf-skills
xaf
DevExpress XAF (eXpressApp Framework) master index. Use this skill first when working with any XAF topic to find the right sub-skill. Covers Blazor and WinForms, EF Core and XPO, versions v24.2 and v25.1. Sub-skills: xaf-xpo-models, xaf-ef-models, xaf-controllers, xaf-editors, xaf-custom-editors, xaf-nonpersistent, xaf-security, xaf-multi-tenant, xaf-web-api, xaf-validation, xaf-reports, xaf-dashboards, xaf-office, xaf-blazor-ui, xaf-winforms-ui, xaf-conditional-appearance, xaf-deployment, xaf-memory-leaks.
13xaf-winforms-ui
XAF WinForms UI platform - WinApplication setup, Ribbon vs Standard toolbar, WinForms-specific editors (XtraGrid, DevExpress controls), Detail View layout customization via Layout Manager, custom WinForms controls embedded in XAF views, background workers for thread-safe UI updates, splash screen customization, WinForms navigation (NavigationFrame), printing/preview in WinForms, ClickOnce/MSI deployment. Use when building or customizing XAF WinForms applications.
10xaf-blazor-ui
XAF Blazor UI platform - BlazorApplication setup in Program.cs, AddXaf/AddXafBlazor services, InvokeAsync thread safety (critical for Blazor Server), async controller actions pattern, Blazor-specific editors, embedding custom Razor components as ViewItems using IComponentContentHolder, JavaScript interop via IJSRuntime, Detail View layout customization (tabs/groups), programmatic navigation, error handling with UserFriendlyException, SignalR configuration. Use when building or customizing XAF Blazor Server applications.
10xaf-office
XAF Office/Document Management Modules - FileAttachmentsModule with IFileData/FileAttachment patterns (XPO and EF Core), SpreadsheetModule for Excel editing with ISpreadsheetValueStorage, RichTextModule for Word-like editing with IRichTextDocumentProvider and mail merge, PdfViewerModule for PDF display, platform differences (Blazor vs WinForms), programmatic document manipulation. Use when adding file attachments, spreadsheet editing, rich text editing, or PDF viewing to DevExpress XAF applications.
9xaf-reports
XAF Reports Module (XtraReports v2) - ReportsModuleV2 setup for Blazor and WinForms, report storage (DB/filesystem/custom IReportStorageWebExtension), creating predefined reports in code (PredefinedReportsUpdater), data sources (CollectionDataSource/EntityServerModeSource), report parameters, programmatic export (PDF/Excel/Word), in-app designer, PrintAction, security permissions for report design vs view. Use when working with DevExpress XtraReports integration in XAF.
9xaf-editors
XAF built-in property editors and list editors - editor type mapping by data type, EditorAliases constants, [EditorAlias] attribute, [ModelDefault] for DisplayFormat/EditMask, ObjectPropertyEditor for inline sub-forms, list editor types (GridListEditor, DxGridListEditor, TreeListEditor, ChartListEditor), GridListEditor WinForms customization, DxGridListEditor Blazor customization, IModelListView/IModelColumn properties. Use when working with built-in XAF editors or customizing grid/list views.
8