Skip to content

Commit dcfdee7

Browse files
authored
Update EF Core tooling breaking change (#34814)
1 parent c478c6d commit dcfdee7

File tree

1 file changed

+46
-113
lines changed
  • aspnetcore/blazor/tutorials/movie-database-app

1 file changed

+46
-113
lines changed

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

Lines changed: 46 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ 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"
123-
124122
```dotnetcli
125123
dotnet tool install --global dotnet-aspnet-codegenerator
126124
dotnet tool install --global dotnet-ef
@@ -136,56 +134,32 @@ dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
136134
> [!IMPORTANT]
137135
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
138136
139-
:::moniker-end
140-
141-
:::moniker range=">= aspnetcore-9.0 < aspnetcore-10.0"
142-
143-
```dotnetcli
144-
dotnet tool install --global dotnet-aspnet-codegenerator
145-
dotnet tool install --global dotnet-ef
146-
dotnet add package Microsoft.EntityFrameworkCore.SQLite
147-
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
148-
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
149-
dotnet add package Microsoft.EntityFrameworkCore.Tools
150-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
151-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
152-
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
153-
dotnet add package Microsoft.EntityFrameworkCore.Design
154-
```
155-
156-
> [!IMPORTANT]
157-
> After the first nine commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
158-
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:
160-
161-
```diff
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>
167-
```
168-
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-
:::moniker range="< aspnetcore-9.0"
137+
:::moniker range=">= aspnetcore-9.0"
174138

175-
```dotnetcli
176-
dotnet tool install --global dotnet-aspnet-codegenerator
177-
dotnet tool install --global dotnet-ef
178-
dotnet add package Microsoft.EntityFrameworkCore.SQLite
179-
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
180-
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
181-
dotnet add package Microsoft.EntityFrameworkCore.Tools
182-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
183-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
184-
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
185-
```
139+
<!-- UPDATE 10.0 - Remove this when the 9.0.300 SDK lands. -->
186140

187141
> [!IMPORTANT]
188-
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
142+
> A breaking change in EF Core tooling for .NET SDK 9.0.200 prevents scaffolding from executing with the following exception:
143+
>
144+
> > :::no-loc text="Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.":::
145+
>
146+
> To resolve the error until the .NET SDK 9.0.300 is released, add a package reference to the app for the [`Microsoft.EntityFrameworkCore.Design`](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Design) NuGet package:
147+
>
148+
> ```dotnetcli
149+
> dotnet add package Microsoft.EntityFrameworkCore.Design
150+
> ```
151+
>
152+
> 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:
153+
>
154+
> ```diff
155+
> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
156+
> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
157+
> <PrivateAssets>all</PrivateAssets>
158+
> + <Publish>true</Publish>
159+
> </PackageReference>
160+
> ```
161+
>
162+
> The preceding changes are a workaround for a breaking change in .NET 9.0.200 EF Core tooling. This workaround won't be required for .NET SDK 9.0.300 or later, when the entire package reference can be removed from the app. 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).
189163
190164
:::moniker-end
191165
@@ -219,73 +193,32 @@ Paste all of the following commands at the prompt (`>`) of the command shell. W
219193
220194
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.
221195
222-
:::moniker range=">= aspnetcore-10.0"
223-
224-
```dotnetcli
225-
dotnet tool install --global dotnet-aspnet-codegenerator
226-
dotnet tool install --global dotnet-ef
227-
dotnet add package Microsoft.EntityFrameworkCore.SQLite
228-
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
229-
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
230-
dotnet add package Microsoft.EntityFrameworkCore.Tools
231-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
232-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
233-
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
234-
```
235-
236-
> [!IMPORTANT]
237-
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
238-
239-
:::moniker-end
240-
241-
:::moniker range=">= aspnetcore-9.0 < aspnetcore-10.0"
242-
243-
```dotnetcli
244-
dotnet tool install --global dotnet-aspnet-codegenerator
245-
dotnet tool install --global dotnet-ef
246-
dotnet add package Microsoft.EntityFrameworkCore.SQLite
247-
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
248-
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
249-
dotnet add package Microsoft.EntityFrameworkCore.Tools
250-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
251-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
252-
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
253-
dotnet add package Microsoft.EntityFrameworkCore.Design
254-
```
255-
256-
> [!IMPORTANT]
257-
> After the first nine commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
258-
259-
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:
260-
261-
```diff
262-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
263-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
264-
<PrivateAssets>all</PrivateAssets>
265-
+ <Publish>true</Publish>
266-
</PackageReference>
267-
```
268-
269-
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).
270-
271-
:::moniker-end
272-
273-
:::moniker range="< aspnetcore-9.0"
196+
:::moniker range=">= aspnetcore-9.0"
274197
275-
```dotnetcli
276-
dotnet tool install --global dotnet-aspnet-codegenerator
277-
dotnet tool install --global dotnet-ef
278-
dotnet add package Microsoft.EntityFrameworkCore.SQLite
279-
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
280-
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
281-
dotnet add package Microsoft.EntityFrameworkCore.Tools
282-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
283-
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
284-
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
285-
```
198+
<!-- UPDATE 10.0 - Remove this when the 9.0.300 SDK lands. -->
286199
287200
> [!IMPORTANT]
288-
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
201+
> A breaking change in EF Core tooling for .NET SDK 9.0.200 prevents scaffolding from executing with the following exception:
202+
>
203+
> > :::no-loc text="Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.":::
204+
>
205+
> To resolve the error until the .NET SDK 9.0.300 is released, add a package reference to the app for the [`Microsoft.EntityFrameworkCore.Design`](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Design) NuGet package:
206+
>
207+
> ```dotnetcli
208+
> dotnet add package Microsoft.EntityFrameworkCore.Design
209+
> ```
210+
>
211+
> 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:
212+
>
213+
> ```diff
214+
> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
215+
> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
216+
> <PrivateAssets>all</PrivateAssets>
217+
> + <Publish>true</Publish>
218+
> </PackageReference>
219+
> ```
220+
>
221+
> The preceding changes are a workaround for a breaking change in .NET 9.0.200 EF Core tooling. This workaround won't be required for .NET SDK 9.0.300 or later, when the entire package reference can be removed from the app. 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).
289222
290223
:::moniker-end
291224

0 commit comments

Comments
 (0)