Skip to content

Commit 0c97069

Browse files
authored
Document -NoBuild switch for PMC Update-Database and Add-Migration
1 parent 43f38e1 commit 0c97069

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

entity-framework/core/cli/powershell.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Parameters:
124124
| <nobr>`-Name <String>`</nobr> | The name of the migration. This is a positional parameter and is required. |
125125
| <nobr>`-OutputDir <String>`</nobr> | The directory use to output the files. Paths are relative to the target project directory. Defaults to "Migrations". |
126126
| <nobr>`-Namespace <String>`</nobr> | The namespace to use for the generated classes. Defaults to generated from the output directory. |
127+
| <nobr>`-NoBuild`</nobr> | Don't build the project before running the command. Intended to be used when the build is up-to-date. |
127128

128129
The [common parameters](#common-parameters) are listed above.
129130

@@ -319,6 +320,7 @@ Updates the database to the last migration or to a specified migration.
319320
| <nobr>`-Add`</nobr> | Creates a new migration and applies it to the database in a single step. Uses Roslyn to compile the migration at runtime. When specified, a migration name is required and provides the name for the new migration. Added in EF Core 11. |
320321
| <nobr>`-OutputDir <String>`</nobr> | The directory to put migration files in. Paths are relative to the target project directory. Requires `-Add`. Added in EF Core 11. |
321322
| <nobr>`-Namespace <String>`</nobr> | The namespace to use for the generated migration classes. Requires `-Add`. Added in EF Core 11. |
323+
| <nobr>`-NoBuild`</nobr> | Don't build the project before running the command. Intended to be used when the build is up-to-date. Added in EF Core 11. |
322324

323325
The [common parameters](#common-parameters) are listed above.
324326

entity-framework/core/what-is-new/ef-core-11.0/whatsnew.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,25 @@ Explicit command-line options always take precedence over configuration file val
899899

900900
For more information, see [Configuration file](xref:core/cli/dotnet#configuration-file).
901901

902+
<a name="pmc-nobuild"></a>
903+
904+
### `-NoBuild` for PMC `Update-Database`
905+
906+
> [!NOTE]
907+
> This feature is being introduced in EF Core 11, which is currently in preview.
908+
909+
The Package Manager Console `Update-Database` command now supports the `-NoBuild` switch, which skips the project build step before applying migrations. This aligns `Update-Database` with `Add-Migration`, which already supported `-NoBuild`.
910+
911+
This is useful when a build succeeds but produces warnings that Visual Studio's Package Manager Console treats as errors (such as NuGet vulnerability warnings), which would otherwise block the command from running:
912+
913+
```powershell
914+
Update-Database -NoBuild
915+
```
916+
917+
Only use `-NoBuild` when the project is already up-to-date, since running with a stale build may produce unexpected results.
918+
919+
For more information, see the [PMC tools reference](xref:core/cli/powershell#update-database).
920+
902921
<a name="dotnet-ef-context-wildcard"></a>
903922

904923
### Wildcard context support for migration commands

0 commit comments

Comments
 (0)