asp.net mvc – ‘An item with the same key has already been added ‘when Generate Database from Model …’ (VS C# MVC)


An ASP.NET MVC web application in C# with individual accounts authentication has been created using a local file database. All account tables were automatically created, and user accounts were tested successfully. The website is running fine at this stage.

After adding the .EDMX model using the ‘Model First’ approach with a sample entity table, I get an error

An item with the same key has already been added

when attempting to ‘Generate Database from Model…’.

Has anyone encountered a similar issue?

I’m running on the .NET Framework 4.7.2, and using EF 6.4.4

Windows 10 Pro (Build 19045) and the same on Windows 11 Pro (Build 22631)

Visual Studio Community 2022 (64-bit) v. 17.10.3

Leave a Reply

Your email address will not be published. Required fields are marked *