JD.Efcpt.Sdk
0.19.0
See the version list below for details.
<Sdk Name="JD.Efcpt.Sdk" Version="0.19.0" />
#:sdk JD.Efcpt.Sdk@0.19.0
JD.Efcpt.Build
MSBuild integration for EF Core Power Tools CLI
Automate database-first EF Core model generation during dotnet build. Zero manual steps, full CI/CD support, reproducible builds.
Quick Start
Option A: Project Template (Easiest)
dotnet new install JD.Efcpt.Build.Templates
dotnet new efcptbuild --name MyDataProject
dotnet build
Option B: SDK Approach (Recommended)
<Project Sdk="JD.Efcpt.Sdk/0.19.0">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
Option C: PackageReference
dotnet add package JD.Efcpt.Build
dotnet build
.NET 8-9 users: Install the CLI tool first:
dotnet tool install -g ErikEJ.EFCorePowerTools.Cli --version "10.*".NET 10+ users: No tool installation needed - uses
dnxautomatically.
Pipeline Overview
The complete workflow from database to EF Core models, with scaffolding as a build-time step:
graph LR
K["Entry Points"]
K -->|Template| L["dotnet new efcptbuild"]
K -->|SDK| M["Project Sdk=JD.Efcpt.Sdk"]
K -->|Package| N["PackageReference JD.Efcpt.Build"]
L & M & N -->|dotnet build| Build["<b>Build Process<br/>(BeforeTargets=CoreCompile)</b>"]
A["Live Database"] -->|Connection| B["Query Schema"]
C["SQL Project (.sqlproj)"] -->|Build| D["DACPAC"]
Direct["Direct DACPAC<br/>(EfcptDacpacPath)"] -->|DACPAC File| D
B & D -->|Schema Metadata| Build
F["Configuration<br/>(efcpt-config.json)"] -->|Config| Build
G["T4 Templates"] -->|Templates| Build
Build -->|Generate Code| H["EF Core Models"]
H -->|Compile| I["Assembly<br/>(.dll/.exe)"]
Available Packages
| Package | Purpose | Usage |
|---|---|---|
| JD.Efcpt.Build | MSBuild integration | Add as PackageReference |
| JD.Efcpt.Sdk | SDK package (cleanest setup) | Use as project SDK |
| JD.Efcpt.Build.Templates | Project templates | dotnet new install |
| Package | Purpose | Usage |
|---|---|---|
| JD.Efcpt.Build | MSBuild integration | Add as PackageReference |
| JD.Efcpt.Sdk | SDK package (cleanest setup) | Use as project SDK |
| JD.Efcpt.Build.Templates | Project templates | dotnet new install |
Key Features
- Automatic generation - DbContext and entities generated during
dotnet build - Incremental builds - Only regenerates when schema or config changes
- Database-First SqlProj Generation - Extract schema from live databases to DACPAC (NEW!)
- Dual input modes - Works with SQL Projects (.sqlproj) or live database connections
- Smart discovery - Auto-finds database projects and configuration files
- T4 template support - Customize code generation with your own templates
- Multi-schema support - Generate models across multiple database schemas
- CI/CD ready - Works everywhere .NET runs (GitHub Actions, Azure DevOps, Docker)
- Cross-platform SQL Projects - Supports Microsoft.Build.Sql and MSBuild.Sdk.SqlProj
Documentation
| Topic | Description |
|---|---|
| Getting Started | Installation and first project setup |
| Using the SDK | SDK approach for cleanest project files |
| Configuration | MSBuild properties and JSON config options |
| Connection String Mode | Generate from live databases |
| T4 Templates | Customize code generation |
| CI/CD Integration | GitHub Actions, Azure DevOps, Docker |
| Troubleshooting | Common issues and solutions |
| API Reference | Complete MSBuild properties and tasks |
| Core Concepts | How the build pipeline works |
| Architecture | Internal architecture details |
How JD.Efcpt.Build Compares
| Feature | JD.Efcpt.Build | dotnet ef dbcontext scaffold |
EF Core Power Tools GUI | Plain efcpt CLI |
|---|---|---|---|---|
| Build-time automation | Yes (MSBuild target) | Manual only | Manual only | Manual only |
| Incremental regeneration | Yes (fingerprinting) | N/A | No | No |
| DACPAC/.sqlproj support | Yes (SQL Server) | No | Yes (GUI-only) | Yes |
| Live DB input | Yes | Yes | Yes | Yes |
| Config persisted | Yes (efcpt-config.json, auto-applied) | Per-command args | efcpt-config.json (manual re-run) | efcpt-config.json (manual re-run) |
| CI/CD ready | Yes (fully automated) | Limited | No | Limited |
| T4 template customization | Yes | No | Yes | Yes |
| Multi-schema support | Yes | Yes | Yes | Yes |
Use JD.Efcpt.Build when you want automated, reproducible model generation as part of your build pipeline. Use the CLI directly when you need occasional scaffolding without build-step integration.
Database Provider Support
JD.Efcpt.Build supports multiple database providers through EF Core Power Tools:
- SQL Server (.sqlproj) - Full support: DACPAC, connection string mode, incremental builds. Driver ships bundled with the core
JD.Efcpt.Buildpackage. - PostgreSQL, MySQL, SQLite, Oracle, Firebird, Snowflake - Connection string mode only (no DACPAC generation). Each driver ships as a separate satellite package you install alongside
JD.Efcpt.Build- this keeps the core package lightweight for projects that only need SQL Server.
Note: Traditional (non-SDK-style)
.sqlprojbuilds are Windows-only. For cross-platform SQL projects, use Microsoft.Build.Sql or MSBuild.Sdk.SqlProj (both cross-platform). DACPAC files are SQL Server-specific. For non-SQL-Server databases, use Connection String Mode to scaffold directly from a live database connection.
Installing a provider driver
# Example: PostgreSQL
dotnet add package JD.Efcpt.Build.PostgreSQL
EfcptProvider |
Satellite package |
|---|---|
mssql (default) |
(bundled - no install needed) |
postgres |
JD.Efcpt.Build.PostgreSQL |
mysql |
JD.Efcpt.Build.MySqlConnector |
sqlite |
JD.Efcpt.Build.Sqlite |
oracle |
JD.Efcpt.Build.Oracle |
firebird |
JD.Efcpt.Build.Firebird |
snowflake |
JD.Efcpt.Build.Snowflake |
If you set EfcptProvider without installing the matching package, the build fails fast with a
ProviderDriverNotFoundException that includes the exact dotnet add package command to fix
it - see Provider Support
for details.
For detailed provider-specific guidance, see Provider Support and Provider Configuration.
Requirements
- .NET SDK 8.0+
- EF Core Power Tools CLI - Auto-executed via
dnxon .NET 10+; requires manual install on .NET 8-9 - Database source - SQL Server Database Project (.sqlproj) or live database connection
Supported SQL Project Types
| Type | Extension | Cross-Platform |
|---|---|---|
| Microsoft.Build.Sql | .sqlproj |
Yes |
| MSBuild.Sdk.SqlProj | .csproj / .fsproj |
Yes |
| Traditional SQL Projects | .sqlproj |
Windows only |
New: Database-First SQL Generation
Automatically generate SQL scripts from your live database when JD.Efcpt.Build detects it's referenced in a SQL project:
DatabaseProject (SQL):
<Project Sdk="MSBuild.Sdk.SqlProj/3.3.0">
<PropertyGroup>
<EfcptConnectionString>Server=...;Database=MyDb;...</EfcptConnectionString>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JD.Efcpt.Build" Version="0.19.0" />
</ItemGroup>
</Project>
DataAccessProject (EF Core):
<ItemGroup>
<ProjectReference Include="..\DatabaseProject\DatabaseProject.csproj" />
<PackageReference Include="JD.Efcpt.Build" Version="0.19.0" />
</ItemGroup>
This enables the complete two-project workflow:
Live Database → SQL Scripts (in SQL Project) → DACPAC → EF Core Models (in DataAccess Project)
Benefits:
- ✅ Automatic SQL project detection (no configuration needed)
- ✅ Database as source of truth
- ✅ Human-readable SQL scripts for review and version control
- ✅ Clean separation: Database project (schema) + DataAccess project (models)
- ✅ Incremental builds with schema fingerprinting
- ✅ Works with .NET 10+
dnx(no sqlpackage installation required)
See the Database-First SQL Generation sample for a complete example.
Samples
See the samples directory for complete working examples:
- Simple Generation - Basic DACPAC-based generation
- SDK Zero Config - Minimal SDK project setup
- Database-First SQL Generation - Auto-generate SQL scripts from live database (NEW!)
- Connection String Mode - Generate from live database
- Custom Renaming - Table and column renaming
- Schema Organization - Multi-schema folder structure
- Split Outputs - Separate Models and Data projects
Contributing
Contributions are welcome! Please open an issue first to discuss changes. See CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License. See LICENSE for details.
Acknowledgments
- EF Core Power Tools by Erik Ejlskov Jensen - The tool this package automates
- Microsoft - For Entity Framework Core and MSBuild
Support
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and community support
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.25.5 | 0 | 7/12/2026 |
| 0.25.4 | 31 | 7/12/2026 |
| 0.25.3 | 38 | 7/12/2026 |
| 0.25.2 | 33 | 7/11/2026 |
| 0.25.1 | 40 | 7/11/2026 |
| 0.25.0 | 38 | 7/11/2026 |
| 0.24.0 | 42 | 7/11/2026 |
| 0.23.0 | 40 | 7/11/2026 |
| 0.22.1 | 41 | 7/11/2026 |
| 0.22.0 | 38 | 7/11/2026 |
| 0.21.0 | 35 | 7/11/2026 |
| 0.20.0 | 40 | 7/11/2026 |
| 0.19.0 | 40 | 7/11/2026 |
| 0.18.0 | 41 | 7/11/2026 |
| 0.17.0 | 50 | 7/11/2026 |
| 0.16.2 | 47 | 7/11/2026 |
| 0.16.1 | 35 | 7/11/2026 |
| 0.16.0 | 45 | 7/10/2026 |
| 0.15.49 | 51 | 7/10/2026 |
| 0.15.48 | 53 | 7/10/2026 |