Skip to content

Commit 87c3ef6

Browse files
Add breaking change note for EF Core 10 tools with multi-targeted projects (#5200)
Co-authored-by: AndriySvyryd <[email protected]>
1 parent 9c61935 commit 87c3ef6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

entity-framework/core/what-is-new/ef-core-10.0/breaking-changes.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This page documents API and behavior changes that have the potential to break ex
2222
2323
| **Breaking change** | **Impact** |
2424
|:--------------------------------------------------------------------------------------------------------------- | -----------|
25+
| [EF tools now require framework to be specified for multi-targeted projects](#ef-tools-multi-targeting) | Medium |
2526
| [Application Name is now injected into the connection string](#sqlserver-application-name) | Low |
2627
| [SQL Server json data type used by default on Azure SQL and compatibility level 170](#sqlserver-json-data-type) | Low |
2728
| [Parameterized collections now use multiple parameters by default](#parameterized-collections) | Low |
@@ -31,6 +32,54 @@ This page documents API and behavior changes that have the potential to break ex
3132
| [IDiscriminatorPropertySetConvention signature changed](#discriminator-convention-signature) | Low |
3233
| [IRelationalCommandDiagnosticsLogger methods add logCommandText parameter](#logger-logcommandtext) | Low |
3334

35+
## Medium-impact changes
36+
37+
<a name="ef-tools-multi-targeting"></a>
38+
39+
### EF tools now require framework to be specified for multi-targeted projects
40+
41+
[Tracking Issue #37230](https://github.com/dotnet/efcore/issues/37230)
42+
43+
#### Old behavior
44+
45+
Previously, the EF tools (dotnet-ef) could be used on projects targeting multiple frameworks without specifying which framework to use.
46+
47+
#### New behavior
48+
49+
Starting with EF Core 10.0, when running EF tools on a project that targets multiple frameworks (using `<TargetFrameworks>` instead of `<TargetFramework>`), you must explicitly specify which target framework to use with the `--framework` option. Without this option, the following error will be thrown:
50+
51+
> The project targets multiple frameworks. Use the --framework option to specify which target framework to use.
52+
53+
#### Why
54+
55+
In EF Core 10, the tools started relying on the `ResolvePackageAssets` MSBuild task to get more accurate information about project dependencies. However, this task is not available if the project is targeting multiple target frameworks (TFMs). The solution requires users to select which framework should be used.
56+
57+
#### Mitigations
58+
59+
When running any EF tools command on a project that targets multiple frameworks, specify the target framework using the `--framework` option. For example:
60+
61+
```bash
62+
dotnet ef migrations add MyMigration --framework net9.0
63+
```
64+
65+
```bash
66+
dotnet ef database update --framework net9.0
67+
```
68+
69+
```bash
70+
dotnet ef migrations script --framework net9.0
71+
```
72+
73+
If your project file looks like this:
74+
75+
```xml
76+
<PropertyGroup>
77+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
78+
</PropertyGroup>
79+
```
80+
81+
You'll need to choose one of the frameworks (e.g., `net9.0`) when running the EF tools.
82+
3483
## Low-impact changes
3584

3685
<a name="sqlserver-application-name"></a>

0 commit comments

Comments
 (0)