diff --git a/src/EFCore.Tasks/PACKAGE.md b/src/EFCore.Tasks/PACKAGE.md
index e23d373b089..3a3dfd6914b 100644
--- a/src/EFCore.Tasks/PACKAGE.md
+++ b/src/EFCore.Tasks/PACKAGE.md
@@ -4,12 +4,12 @@ This package should be referenced by the project containing the derived `DbConte
## Usage
-Install the package into your project, set `true` and then run build normally.
-
-If the startup project is different from the current project it needs to be specified: `..\Startup\Startup.csproj`
+Install the package into your project and then run build normally. For solutions where specifying the startup project is necessary, set `..\Startup\Startup.csproj`
The startup project must also reference the `Microsoft.EntityFrameworkCore.Tasks` package.
+You can control when code generation occurs by setting `build` or `build` to generate during build instead of the default publish stage.
+
## Getting started with EF Core
See [Getting started with EF Core](https://learn.microsoft.com/ef/core/get-started/overview/install) for more information about EF NuGet packages, including which to install when getting started.
diff --git a/src/EFCore.Tasks/buildTransitive/Microsoft.EntityFrameworkCore.Tasks.targets b/src/EFCore.Tasks/buildTransitive/Microsoft.EntityFrameworkCore.Tasks.targets
index ce2f7cf90a5..856f52b3097 100644
--- a/src/EFCore.Tasks/buildTransitive/Microsoft.EntityFrameworkCore.Tasks.targets
+++ b/src/EFCore.Tasks/buildTransitive/Microsoft.EntityFrameworkCore.Tasks.targets
@@ -23,7 +23,6 @@
+ Condition="'$(_EFGenerationStage)'=='' And ('$(EFScaffoldModelStage)'=='build' Or '$(EFPrecompileQueriesStage)'=='build')">
+ Condition="'$(_EFGenerationStage)'=='' And ('$(EFScaffoldModelStage)'=='publish' Or '$(EFPrecompileQueriesStage)'=='publish')">>
a == "--no-scaffold");
- startupProject.Build(skipOptimization ? new[] { "/p:EFOptimizeContext=false" } : null);
+ startupProject.Build(skipOptimization ? new[] { "/p:EFScaffoldModelStage=none", "/p:EFPrecompileQueriesStage=none" } : null);
Reporter.WriteInformation(Resources.BuildSucceeded);
}