2

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?

1 Answer 1

3

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.

2
  • Thanks Patrick. My current planned structure for my application is to have a server running the main data processing routines once a day, stored in a 'main' database, then for each remote PC running the client application to have a 'lite' database just to store the data computed previously. What is the best way for me to have my server and remote versions of the application update whilst keeping the existing database file intact?
    – Anonymous
    Sep 1, 2012 at 13:17
  • 1
    I'm afraid I haven't tried this scenario before, social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/… may be useful reading. Essentially what you want to do here is to ensure the database files are not being overwritten on update. You may need to set up a folder in C:\Program Files\ for your application and ensure the database gets installed there, and the connection string in the app.config links to that absolute directory reference. Sep 1, 2012 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.