This sample demonstrates the simplest possible setup using JD.Efcpt.Sdk as an MSBuild SDK.
Instead of adding a PackageReference to JD.Efcpt.Build, you can use JD.Efcpt.Sdk as your project SDK:
global.json (at solution root):
{
"msbuild-sdks": {
"JD.Efcpt.Sdk": "1.0.0"
}
}EntityFrameworkCoreProject.csproj:
<Project Sdk="JD.Efcpt.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DatabaseProject\DatabaseProject.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>None</OutputItemType>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
</ItemGroup>
</Project>The SDK:
- Extends
Microsoft.NET.Sdkwith EF Core Power Tools integration - Automatically detects the SQL project via
ProjectReference - Builds the SQL project to DACPAC and generates EF Core models
- Requires no additional configuration
- .NET 8.0 SDK or later
- JD.Efcpt.Sdk package available (via NuGet or local package source)
# From the sample directory
dotnet buildThe build will:
- Build the
DatabaseProjectto produce a DACPAC - Run EF Core Power Tools to generate models from the DACPAC
- Compile the generated models
Generated files appear in EntityFrameworkCoreProject/obj/efcpt/Generated/.
To test with a locally-built SDK package:
# From the repo root
dotnet pack src/JD.Efcpt.Sdk/JD.Efcpt.Sdk.csproj -o pkg
# From the sample directory
dotnet buildThe nuget.config in this sample is already configured to look for packages in ../../pkg.