I'm trying to add a database to a C# Windows Form application using Entity Framework 6 database first model. When I publish it using Microsoft Visual Studio Installer projects the database is not attached to the application.
How can I deploy an .mdf database along with the application executable?
- I have selected the needed prerequisites (.NET Framework and SQL Server Express).
- I am using Entity Framework 6 (EF6) and my database has a username and password (SQL Server authentication).
- I have already included the .mdf file in the project and in the output directory.
- I have tried the solution here How to deploy application with sql server database on clients and here How to Deploy "SQL Server Express + EF" Application
- I have also tried to use SQL(localDB) instead of SQL Server Express, but it throws the same exception.