You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: added the ability to split model generation across two projects for data-domain model segregation (#14)
* feat: added the ability to split model generation across two projects for data-domain model segregation
- Updated README and split-outputs documentation to clarify project roles (#11, #12).
- Modified DbContext template to skip foreign keys without navigation properties.
- Adjusted project file configurations for Models and Data projects to improve clarity and functionality.
- Updated built-in templates to be version aware.
- Updated default efcpt-config.json to not exclude all objects (#16)
**Step 2:***(Optional for .NET 10+)* Ensure EF Core Power Tools CLI is available:
30
+
**That's it!**Your EF Core DbContext and entities are now automatically generated from your database project during every build.
27
31
28
-
> **✨ .NET 10+ Users:** The tool is automatically executed via `dnx` and does **not** need to be installed. Skip this step if you're using .NET 10.0 or later!
32
+
> **✨ .NET 8 and 9 Users must install the `ErikEJ.EFCorePowerTools.Cli` tool in advance:**
-**Traditional `.sqlproj`** - Requires Windows/Visual Studio build tools
114
122
115
123
### Step 1: Install the Package
116
124
@@ -772,6 +780,8 @@ dotnet build
772
780
773
781
### GitHub Actions
774
782
783
+
> **💡 Cross-Platform Support:** If you use [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) or [Microsoft.Build.Sql](https://github.com/microsoft/DacFx) for your database project, you can use `ubuntu-latest` instead of `windows-latest` runners. Traditional `.sqlproj` files require Windows build agents.
784
+
775
785
**.NET 10+ (Recommended - No tool installation required!)**
776
786
777
787
```yaml
@@ -781,7 +791,7 @@ on: [push, pull_request]
781
791
782
792
jobs:
783
793
build:
784
-
runs-on: windows-latest
794
+
runs-on: windows-latest# Use ubuntu-latest with MSBuild.Sdk.SqlProj or Microsoft.Build.Sql
785
795
786
796
steps:
787
797
- uses: actions/checkout@v3
@@ -810,7 +820,7 @@ on: [push, pull_request]
810
820
811
821
jobs:
812
822
build:
813
-
runs-on: windows-latest
823
+
runs-on: windows-latest# Use ubuntu-latest with MSBuild.Sdk.SqlProj or Microsoft.Build.Sql
814
824
815
825
steps:
816
826
- uses: actions/checkout@v3
@@ -840,7 +850,7 @@ trigger:
840
850
- main
841
851
842
852
pool:
843
-
vmImage: 'windows-latest'
853
+
vmImage: 'windows-latest'# Use ubuntu-latest with MSBuild.Sdk.SqlProj or Microsoft.Build.Sql
844
854
845
855
steps:
846
856
- task: UseDotNet@2
@@ -868,6 +878,8 @@ steps:
868
878
869
879
### Docker
870
880
881
+
> **💡 Note:** Docker builds work with [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) or [Microsoft.Build.Sql](https://github.com/microsoft/DacFx) database projects. Traditional `.sqlproj` files are not supported in Linux containers.
882
+
871
883
```dockerfile
872
884
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
873
885
WORKDIR /src
@@ -892,7 +904,7 @@ RUN dotnet build --configuration Release --no-restore
892
904
1. **Use .NET 10+** - Eliminates the need for tool manifests and installation steps via `dnx`
893
905
2. **Use local tool manifest (.NET 8-9)** - Ensures consistent `efcpt` version across environments
894
906
3. **Cache tool restoration (.NET 8-9)** - Speed up builds by caching `.dotnet/tools`
895
-
4.**Windows agents for DACPAC** - Database projects typically require Windows build agents
907
+
4. **Cross-platform SQL projects** - Use [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) or [Microsoft.Build.Sql](https://github.com/microsoft/DacFx) to build DACPACs on Linux/macOS (traditional `.sqlproj` requires Windows)
896
908
5. **Deterministic builds** - Generated code should be identical across builds with same inputs
897
909
898
910
---
@@ -1185,7 +1197,10 @@ By default the build uses `dotnet tool run efcpt` when a local tool manifest is
1185
1197
1186
1198
- .NET SDK 8.0 or newer.
1187
1199
- EF Core Power Tools CLI installed as a .NET tool (global or local).
1188
-
- A SQL Server Database Project (`.sqlproj`) that can be built to a DACPAC. On build agents this usually requires the appropriate SQL Server Data Tools / build tools components.
1200
+
- A SQL Server Database Project that compiles to a DACPAC:
1201
+
- **[MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj)** - Cross-platform, works on Linux/macOS/Windows
- **Traditional `.sqlproj`** - Requires Windows with SQL Server Data Tools / build tools components
1189
1204
1190
1205
---
1191
1206
@@ -1451,7 +1466,7 @@ No special steps are required beyond installing the prerequisites. A typical CI
1451
1466
1452
1467
On each run the EF Core models are regenerated only when the DACPAC or EF Core Power Tools inputs change.
1453
1468
1454
-
Ensure that the build agent has the necessary SQL Server Data Tools components to build the `.sqlproj`to a DACPAC.
1469
+
> **💡 Tip:** Use [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) or [Microsoft.Build.Sql](https://github.com/microsoft/DacFx) to build DACPACs on Linux/macOS CI agents. Traditional `.sqlproj` files require Windows agents with SQL Server Data Tools components.
1455
1470
1456
1471
---
1457
1472
@@ -1468,7 +1483,8 @@ Ensure that the build agent has the necessary SQL Server Data Tools components t
1468
1483
### 8.2 DACPAC build problems
1469
1484
1470
1485
- Ensure that either `msbuild.exe` (Windows) or `dotnet msbuild` is available.
1471
-
- Install the SQL Server Data Tools / database build components on the machine running the build.
1486
+
- For **traditional `.sqlproj`** files: Install the SQL Server Data Tools / database build components on a Windows machine.
1487
+
- For **cross-platform builds**: Use [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) or [Microsoft.Build.Sql](https://github.com/microsoft/DacFx) which work on Linux/macOS/Windows without additional components.
1472
1488
- Review the detailed build log from the `EnsureDacpacBuilt` task for underlying MSBuild errors.
0 commit comments