I\'ve attempted to add a \"service based data base\" (.mdf) to a project in an asp .net application. From there I\'ve proceeded attempted to create an entity framework model
I had this exact same problem with a C# Console App that was utilizing an .mdf file.
The issue disappeared once I granted NETWORK SERVICE full access to my root-level Visual Studio project directory (and sub directories).
Solution Details: Problems with SQL Server Express user instancing and ASP.net Web Application Projects
See this answer, which might work for you.
Based on your connection string, you might need to add "User Instance" attribute to it.
I was facing same issue in VS 2019. if anyone still facing same issue then please make sure you have/do following things: 1. you should have Sql server Express installed on your m/c 2. should have SSDT installed in VS (in VS 2019- name sure to check this component while installing) for previous version; i guess you have to add this externally 3. add 'User Instance = True' to your connection string and one more thing and I think its optional - open VS and SQL in administrative mode
I have got the same error, it's fixed after the following change.
Deleting the folder C:\Users\User\AppData\Local\Microsoft\Microsoft SQL Server Data worked for me in Windows 7. Have to restart VS after deleting the folder.