Skip to content

Commit 38809f8

Browse files
committed
Improve EF Core breaking change coverage
1 parent b25aea1 commit 38809f8

File tree

1 file changed

+65
-15
lines changed
  • aspnetcore/blazor/tutorials/movie-database-app

1 file changed

+65
-15
lines changed

aspnetcore/blazor/tutorials/movie-database-app/part-2.md

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,27 @@ Paste all of the following commands at the prompt (`>`) of the **Terminal**. Whe
119119

120120
When you paste multiple commands, all of the commands execute except the last one. The last command doesn't execute until you press <kbd>Enter</kbd> on the keyboard.
121121

122+
:::moniker range=">= aspnetcore-10.0 < aspnetcore-9.0"
123+
124+
```dotnetcli
125+
dotnet tool install --global dotnet-aspnet-codegenerator
126+
dotnet tool install --global dotnet-ef
127+
dotnet add package Microsoft.EntityFrameworkCore.SQLite
128+
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
129+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
130+
dotnet add package Microsoft.EntityFrameworkCore.Tools
131+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
132+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
133+
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
134+
```
135+
136+
> [!IMPORTANT]
137+
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
138+
139+
:::moniker-end
140+
141+
:::moniker range="= aspnetcore-9.0"
142+
122143
```dotnetcli
123144
dotnet tool install --global dotnet-aspnet-codegenerator
124145
dotnet tool install --global dotnet-ef
@@ -135,19 +156,23 @@ dotnet add package Microsoft.EntityFrameworkCore.Design
135156
> [!IMPORTANT]
136157
> After the first nine commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
137158
138-
> [!NOTE]
139-
> The preceding commands are .NET CLI commands, and .NET CLI commands are executed when entered at a [PowerShell](/powershell/) prompt, which is the default command shell of the VS Code **Terminal**.
140-
141-
Open the app's project file (`BlazorWebAppMovies.csproj`). Drop the `<IncludeAssets>` and `<PrivateAssets>` from the `Microsoft.EntityFrameworkCore.Design` package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
159+
Open the app's project file (`BlazorWebAppMovies.csproj`). Mark the `Microsoft.EntityFrameworkCore.Design` assembly reference as publishable by adding `<Publish>true</Publish>` to the package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
142160

143161
```diff
144-
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
145-
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
146-
- <PrivateAssets>all</PrivateAssets>
147-
- </PackageReference>
148-
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}" />
162+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
163+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
164+
<PrivateAssets>all</PrivateAssets>
165+
+ <Publish>true</Publish>
166+
</PackageReference>
149167
```
150168

169+
The preceding update to the package reference is a workaround for a breaking change in .NET 9 EF Core tooling. The change to the package reference can be reverted in apps that are eventually updated to .NET 10 or later. For more information, see [Breaking changes in EF Core 9 (EF9)](/ef/core/what-is-new/ef-core-9.0/breaking-changes#microsoftentityframeworkcoredesign-not-found-when-using-ef-tools).
170+
171+
:::moniker-end
172+
173+
> [!NOTE]
174+
> The preceding commands are .NET CLI commands, and .NET CLI commands are executed when entered at a [PowerShell](/powershell/) prompt, which is the default command shell of the VS Code **Terminal**.
175+
151176
Save the project file.
152177

153178
The preceding commands add:
@@ -175,6 +200,27 @@ Paste all of the following commands at the prompt (`>`) of the command shell. W
175200

176201
When you paste multiple commands, all of the commands execute except the last one. The last command doesn't execute until you press <kbd>Enter</kbd> on the keyboard.
177202

203+
:::moniker range=">= aspnetcore-10.0 < aspnetcore-9.0"
204+
205+
```dotnetcli
206+
dotnet tool install --global dotnet-aspnet-codegenerator
207+
dotnet tool install --global dotnet-ef
208+
dotnet add package Microsoft.EntityFrameworkCore.SQLite
209+
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
210+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
211+
dotnet add package Microsoft.EntityFrameworkCore.Tools
212+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
213+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
214+
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
215+
```
216+
217+
> [!IMPORTANT]
218+
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
219+
220+
:::moniker-end
221+
222+
:::moniker range="= aspnetcore-9.0"
223+
178224
```dotnetcli
179225
dotnet tool install --global dotnet-aspnet-codegenerator
180226
dotnet tool install --global dotnet-ef
@@ -191,16 +237,20 @@ dotnet add package Microsoft.EntityFrameworkCore.Design
191237
> [!IMPORTANT]
192238
> After the first nine commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
193239
194-
Open the app's project file (`BlazorWebAppMovies.csproj`). Drop the `<IncludeAssets>` and `<PrivateAssets>` from the `Microsoft.EntityFrameworkCore.Design` package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
240+
Open the app's project file (`BlazorWebAppMovies.csproj`). Mark the `Microsoft.EntityFrameworkCore.Design` assembly reference as publishable by adding `<Publish>true</Publish>` to the package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
195241

196242
```diff
197-
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
198-
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
199-
- <PrivateAssets>all</PrivateAssets>
200-
- </PackageReference>
201-
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}" />
243+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
244+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
245+
<PrivateAssets>all</PrivateAssets>
246+
+ <Publish>true</Publish>
247+
</PackageReference>
202248
```
203249

250+
The preceding update to the package reference is a workaround for a breaking change in .NET 9 EF Core tooling. The change to the package reference can be reverted in apps that are eventually updated to .NET 10 or later. For more information, see [Breaking changes in EF Core 9 (EF9)](/ef/core/what-is-new/ef-core-9.0/breaking-changes#microsoftentityframeworkcoredesign-not-found-when-using-ef-tools).
251+
252+
:::moniker-end
253+
204254
Save the project file.
205255

206256
The preceding commands add:

0 commit comments

Comments
 (0)