You can use Copy if newer
:
The database file is copied from the project directory to the bin directory when you first start the project. Each subsequent time you build a project, the Date Modified property of the files is compared. If the file in the project folder is newer, it is copied to the bin folder, replacing the file that currently exists. If the file in the bin folder is newer, the files are not copied. This option saves any changes made to the data at run time, which means that every time you launch the application and save changes to the data, these changes are visible the next time the application starts.
To set the Copy to Output Directory
property Copy to Output Directory
Copy if newer
Click on the database and change Copy to Output Directory
to Copy if newer
in the properties window.
EDIT: If you just need the main database and you cannot copy it, you can change the connection string to point to your main database, and also change Copy to Output Directory
to Do not copy
.
source share