I created a basic CRUD Winforms application in Visual Studio and deployed it to another PC using the .exe generated by Build -> Publish Data. Where would the database and any other files in the solution for my application be stored on the target machine?
Share
What you are describing is ‘One-Click publishing’.
When you run an application from ‘one-click’ it actually gets run from a temporary folder (usually in C:\Users\?\AppData), you can tell this by looking in task manager (under properties).
This is so that when the application is updated, the new installation files get run from a brand new location, making it seem like the application is being run fresh from the server (it isn’t really, it’s just downloading the client files).
Database files are different. If you want the user to have their own local client database, then referencing the database in solution files in Visual Studio will ensure that the database is copied over with one click. However due to what I explained in the first paragraph – every time the application updates, a new database will be copied across and any database records that were created/updated/deleted in the last deployment will be lost.
A much more common approach is to deploy the client files via ‘One-Click’, and to host the database on a server, with the client connecting via the connection string supplied in the App.config. Therefore you only have one database to maintain, and any client updates won’t mess around with the DB versioning.