.mdf" failed with the operating system error 2(The system cannot find the file specified.)
Your application is missing the App_Data
folder. Right click on your project, select Add
, then Add ASP.Net Folder
and choose the App_Data
folder.
This ensures the correct folder exists for your application.
I had the same error and fixed it by deleting the current App_Data folder, then creating a new one by right-clicking on the project and adding a new App_Data folder from the Add ASP.Net folder option.
I fixed the error deleting the current Add_Data folder since I had cloned the project from a Github repository, then I added the App_Data folder again and ran the migrations with update-database command. This worked for me.