JD.Efcpt.Sdk
0.13.3
<Sdk Name="JD.Efcpt.Sdk" Version="0.13.3" />
#:sdk JD.Efcpt.Sdk@0.13.3
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/1.0.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.
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 |
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 |
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="*" />
</ItemGroup>
</Project>
DataAccessProject (EF Core):
<ItemGroup>
<ProjectReference Include="..\DatabaseProject\DatabaseProject.csproj" />
<PackageReference Include="JD.Efcpt.Build" Version="*" />
</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
Learn more about Target Frameworks and .NET Standard.
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.13.3 | 0 | 1/5/2026 |
| 0.13.2 | 0 | 1/5/2026 |
| 0.13.1 | 0 | 1/5/2026 |
| 0.13.0 | 0 | 1/4/2026 |
| 0.12.3 | 46 | 1/2/2026 |
| 0.12.2 | 47 | 1/1/2026 |
| 0.12.1 | 85 | 1/1/2026 |
| 0.12.0 | 88 | 12/31/2025 |
| 0.11.1 | 89 | 12/31/2025 |
| 0.11.0 | 93 | 12/30/2025 |
| 0.10.10 | 101 | 12/30/2025 |
| 0.10.9 | 102 | 12/30/2025 |
| 0.10.8 | 98 | 12/30/2025 |
| 0.10.7 | 101 | 12/30/2025 |
| 0.10.6 | 102 | 12/30/2025 |
| 0.10.5 | 99 | 12/30/2025 |
| 0.10.4 | 106 | 12/29/2025 |
| 0.10.3 | 102 | 12/29/2025 |
| 0.10.2 | 103 | 12/28/2025 |
| 0.10.1 | 103 | 12/28/2025 |
| 0.10.0 | 106 | 12/28/2025 |