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.
dotnet new install JD.Efcpt.Build.Templates
dotnet new efcptbuild --name MyDataProject
dotnet build<Project Sdk="JD.Efcpt.Sdk/1.0.0">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>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.
| 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 |
- Automatic generation - DbContext and entities generated during
dotnet build - Incremental builds - Only regenerates when schema or config changes
- 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
| 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 |
- .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
| Type | Extension | Cross-Platform |
|---|---|---|
| Microsoft.Build.Sql | .sqlproj |
Yes |
| MSBuild.Sdk.SqlProj | .csproj / .fsproj |
Yes |
| Traditional SQL Projects | .sqlproj |
Windows only |
See the samples directory for complete working examples:
- Simple Generation - Basic DACPAC-based generation
- SDK Zero Config - Minimal SDK project setup
- 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
Contributions are welcome! Please open an issue first to discuss changes. See CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License. See LICENSE for details.
- EF Core Power Tools by Erik Ejlskov Jensen - The tool this package automates
- Microsoft - For Entity Framework Core and MSBuild
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and community support