I have a project with a SQL Server Compact database included.
- I build the solution it is built into
bin/Release. - I then publish the project from
bin/Releaseto a file server directory where I install it. - I then add some rows to the database in the published application file via its a Winforms then its database gets updated with these additional rows.
- I then go back to the solution in Visual Studio and add some buttons to the form and also add some rubbish records to its database.
- I then rebuild and publish this new version to the file server and run the application
What I notice is that the new buttons from 4 are now on the form but the rubbish rows I added in 4 are not – the db is preserved in the state I left it in 3.
Is there a setting, in the solution, that I can change so that rather than the application databases being preserved they get overwritten by the database in solutions bin/Release files ?
Right click on the database file in visual studio and under the “Copy to Output Directory” field select “Copy always”. This will replace the database file in your bin/Release folder with the one in the project folder every time you rebuild the project.