dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.61k stars 3.14k forks source link

System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey.set_DeleteBehavior(Microsoft.EntityFrameworkCore.DeleteBehavior)' when scaffolding. #28213

Closed AraHaan closed 2 years ago

AraHaan commented 2 years ago

Include your code

I think the issue is that I have a database where tables have primary and foreign keys on some tables (but not all). And after successfully changing the BaseIntermediateOutputPath to the directory above the EFCore project that holds just my DbContext and it's entities.

(It required some manual hacks to get it right)

Powershell script code (GenerateDBContext.ps1)

# restore .net local tool first.
dotnet tool restore

# generate the dbcontext.
dotnet ef dbcontext scaffold "Data Source=SEAN\SQLEXPRESS;Initial Catalog=Bot;Integrated Security=True;Encrypt=True;TrustServerCertificate=True;User Instance=False" Microsoft.EntityFrameworkCore.SqlServer -t DiscordTokens -t ExpiringVerifications -t Patrons -t Roles -t Tiers -t Emojis -t Guilds -t Activities --use-database-names --data-annotations -c BotDbContext --context-dir Model -o Model -n MyBot.Database --no-onconfiguring -f -s "MyBot.Database/MyBot.Database.csproj" -p "MyBot.Database/MyBot.Database.csproj" --msbuildprojectextensionspath "./obj/MyBot.Database/Debug" --verbose

As for the other files will need to be attached as an zip file.

Include stack traces

System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey.set_DeleteBehavior(Microsoft.EntityFrameworkCore.DeleteBehavior)'.
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.AssignOnDeleteAction(DatabaseForeignKey databaseForeignKey, IMutableForeignKey foreignKey)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitForeignKey(ModelBuilder modelBuilder, DatabaseForeignKey foreignKey)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitForeignKeys(ModelBuilder modelBuilder, IList`1 foreignKeys)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitDatabaseModel(ModelBuilder modelBuilder, DatabaseModel databaseModel)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(DatabaseModel databaseModel, ModelReverseEngineerOptions options)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Method not found: 'Void Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey.set_DeleteBehavior(Microsoft.EntityFrameworkCore.DeleteBehavior)'.

Include verbose output

PS H:\Desktop\github\MyBot> ./GenerateDBContext.ps1
Tool 'dotnet-ef' (version '7.0.0-dev') was restored. Available commands: dotnet-ef

Restore was successful.
Using project 'H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj'.
Using startup project 'H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj'.
Writing './obj/MyBot.Database/Debug\MyBot.Database.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\User\AppData\Local\Temp\tmp64F1.tmp /verbosity:quiet /nologo "H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj"
Writing './obj/MyBot.Database/Debug\MyBot.Database.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\User\AppData\Local\Temp\tmp6BD8.tmp /verbosity:quiet /nologo "H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj"
Build started...
dotnet build "H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj" /verbosity:quiet /nologo

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:10.42
Build succeeded.
dotnet exec --depsfile "H:\Desktop\github\MyBot\bin\Debug\net6.0\MyBot.Database.deps.json" --additionalprobingpath C:\Users\User\.nuget\packages --additionalprobingpath "C:\Users\User\Desktop\VS2017 Preview\Shared\NuGetPackages" --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" C:\Users\User\.nuget\packages\dotnet-ef\7.0.0-dev\tools\net6.0\any\tools\net6.0\any\ef.dll dbcontext scaffold "Data Source=SEAN\SQLEXPRESS;Initial Catalog=Bot;Integrated Security=True;Encrypt=True;TrustServerCertificate=True;User Instance=False" Microsoft.EntityFrameworkCore.SqlServer -t DiscordTokens -t ExpiringVerifications -t Patrons -t Roles -t Tiers -t Emojis -t Guilds -t Activities --use-database-names --data-annotations -c BotDbContext --context-dir Model -o Model -n MyBot.Database --no-onconfiguring -f --assembly "H:\Desktop\github\MyBot\bin\Debug\net6.0\MyBot.Database.dll" --project "H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj" --startup-assembly "H:\Desktop\github\MyBot\bin\Debug\net6.0\MyBot.Database.dll" --startup-project "H:\Desktop\github\MyBot\MyBot.Database\MyBot.Database.csproj" --project-dir "H:\Desktop\github\MyBot\MyBot.Database\\" --root-namespace MyBot.Database --language C# --framework net6.0 --nullable --working-dir "H:\Desktop\github\MyBot" --verbose
Using assembly 'MyBot.Database'.
Using startup assembly 'MyBot.Database'.
Using application base 'H:\Desktop\github\MyBot\bin\Debug\net6.0'.
Using working directory 'H:\Desktop\github\MyBot\MyBot.Database'.
Using root namespace 'MyBot.Database'.
Using project directory 'H:\Desktop\github\MyBot\MyBot.Database\'.
Remaining arguments: .
Finding design-time services referenced by assembly 'MyBot.Database'...
Finding design-time services referenced by assembly 'MyBot.Database'...
No referenced design-time services were found.
Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'...
Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'.
Finding IDesignTimeServices implementations in assembly 'MyBot.Database'...
No design-time services were found.
Found default schema 'dbo'.
Found type alias with name 'sys.sysname' which maps to underlying data type nvarchar(128).
Found table with name 'dbo.Activities'.
Found table with name 'dbo.DiscordTokens'.
Found table with name 'dbo.Emojis'.
Found table with name 'dbo.ExpiringVerifications'.
Found table with name 'dbo.Guilds'.
Found table with name 'dbo.Patrons'.
Found table with name 'dbo.Roles'.
Found table with name 'dbo.Tiers'.
Found column with table: dbo.Activities, column name: Id, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Activities, column name: ActivityName, ordinal: 2, data type: sys.nvarchar, maximum length: 100, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Activities, column name: ActivityType, ordinal: 3, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Activities, column name: ActivityUrl, ordinal: 4, data type: sys.nvarchar, maximum length: 200, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.DiscordTokens, column name: Id, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.DiscordTokens, column name: Token, ordinal: 2, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Emojis, column name: Id, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Emojis, column name: EmojiID, ordinal: 2, data type: sys.decimal, maximum length: 13, precision: 20, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Emojis, column name: Name, ordinal: 3, data type: sys.nvarchar, maximum length: 200, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.ExpiringVerifications, column name: Id, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.ExpiringVerifications, column name: DiscordID, ordinal: 2, data type: sys.decimal, maximum length: 13, precision: 20, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.ExpiringVerifications, column name: TierID, ordinal: 3, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.ExpiringVerifications, column name: ExpiresAt, ordinal: 4, data type: sys.datetime, maximum length: 8, precision: 23, scale: 3, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Guilds, column name: Id, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Guilds, column name: GuildID, ordinal: 2, data type: sys.decimal, maximum length: 13, precision: 20, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Name, ordinal: 1, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Email, ordinal: 2, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Twitter, ordinal: 3, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Discord, ordinal: 4, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: PatronStatus, ordinal: 5, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: FollowsYou, ordinal: 6, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: LifetimeAmount, ordinal: 7, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: PledgeAmount, ordinal: 8, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: ChargeFrequency, ordinal: 9, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Tier, ordinal: 10, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Addressee, ordinal: 11, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Street, ordinal: 12, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: City, ordinal: 13, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: State, ordinal: 14, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Zip, ordinal: 15, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Country, ordinal: 16, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Phone, ordinal: 17, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: PatronageSinceDate, ordinal: 18, data type: sys.datetime, maximum length: 8, precision: 23, scale: 3, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: LastChargeDate, ordinal: 19, data type: sys.datetime, maximum length: 8, precision: 23, scale: 3, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: LastChargeStatus, ordinal: 20, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: AdditionalDetails, ordinal: 21, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: UserID, ordinal: 22, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: LastUpdated, ordinal: 23, data type: sys.datetime, maximum length: 8, precision: 23, scale: 3, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: Currency, ordinal: 24, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: MaxPosts, ordinal: 25, data type: sys.varchar, maximum length: -1, precision: 0, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: AccessExpiration, ordinal: 26, data type: sys.datetime, maximum length: 8, precision: 23, scale: 3, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Patrons, column name: NextChargeDate, ordinal: 27, data type: sys.datetime, maximum length: 8, precision: 23, scale: 3, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Roles, column name: Id, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Roles, column name: TierID, ordinal: 2, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: True, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Roles, column name: RoleID, ordinal: 3, data type: sys.decimal, maximum length: 13, precision: 20, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Roles, column name: PatronRole, ordinal: 4, data type: sys.bit, maximum length: 1, precision: 1, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Roles, column name: TierRole, ordinal: 5, data type: sys.bit, maximum length: 1, precision: 1, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Roles, column name: Name, ordinal: 6, data type: sys.nvarchar, maximum length: 200, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Tiers, column name: TierID, ordinal: 1, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: True, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Tiers, column name: Name, ordinal: 2, data type: sys.nvarchar, maximum length: 200, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Tiers, column name: Description, ordinal: 3, data type: sys.nvarchar, maximum length: 200, precision: 0, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found column with table: dbo.Tiers, column name: EmojiID, ordinal: 4, data type: sys.int, maximum length: 4, precision: 10, scale: 0, nullable: False, identity: False, default value: (null), computed value: (null), computed value is stored: False.
Found primary key on table 'PK_Activities' with name 'dbo.Activities'.
Found primary key on table 'PK_DiscordToken' with name 'dbo.DiscordTokens'.
Found primary key on table 'PK_Emojis' with name 'dbo.Emojis'.
Found primary key on table 'PK_ExpiringVerifications' with name 'dbo.ExpiringVerifications'.
Found primary key on table 'PK_Guilds' with name 'dbo.Guilds'.
Found primary key on table 'PK_Patrons' with name 'dbo.Patrons'.
Found primary key on table 'PK_Roles' with name 'dbo.Roles'.
Found primary key on table 'PK_Tiers' with name 'dbo.Tiers'.
Found foreign key on table 'FK_ExpiringVerifications' with name 'dbo.ExpiringVerifications', principal table 'dbo.Tiers', delete action NO_ACTION.
Found foreign key on table 'FK_Roles' with name 'dbo.Roles', principal table 'dbo.Tiers', delete action NO_ACTION.
Found foreign key on table 'FK_Tiers' with name 'dbo.Tiers', principal table 'dbo.Emojis', delete action NO_ACTION.
System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey.set_DeleteBehavior(Microsoft.EntityFrameworkCore.DeleteBehavior)'.
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.AssignOnDeleteAction(DatabaseForeignKey databaseForeignKey, IMutableForeignKey foreignKey)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitForeignKey(ModelBuilder modelBuilder, DatabaseForeignKey foreignKey)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitForeignKeys(ModelBuilder modelBuilder, IList`1 foreignKeys)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitDatabaseModel(ModelBuilder modelBuilder, DatabaseModel databaseModel)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(DatabaseModel databaseModel, ModelReverseEngineerOptions options)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Method not found: 'Void Microsoft.EntityFrameworkCore.Metadata.IMutableForeignKey.set_DeleteBehavior(Microsoft.EntityFrameworkCore.DeleteBehavior)'.

Note: dotnet-ef is a local build of pr #28210 as that is the only way I got the tool to try to build anything at all.

Include provider and version information

EF Core version: 7.0.0-preview.6.22302.1 (I cant downgrade to EFCore 6.0.0 bc I depend on the scaffolding templates feature in my project) Database provider: Microsoft.EntityFrameworkCore.SqlServer (Used within an local provider that extends this to add a few things like conventions for a few additional attributes not included in the normal efcore) Target framework: .NET 6.0 Operating system: Windows 11 IDE: Visual Studio 2022 Latest Public Preview

AraHaan commented 2 years ago

Turns out it is because when the scaffolder tries to run build I set Configuration to Debug when it is not set and that folder seems just have outdated files. Deleting the folder and rerunning resulted in success for some reason.