0

I have a .exe Setup file which i created using Microsoft Setup and Deployment application.Now as per my requirement i have to add my database backup file also along with the setup So that while installing backup file should also be stored in the database.

I have the tested codes of the restoring mysql database using c# but that is from the hardcoded path to find the backup.If it is in Setup what filepath name i can give to restore .

Please help me..

user3924730
  • 163
  • 1
  • 3
  • 14

1 Answers1

1

You can add the database file to the project as an existing item and then set "Copy to Output Directory" to "Copy if newer".

I think the safest approach to locate the folder where all files are stored is:

System.Reflection.Assembly.GetExecutingAssembly().CodeBase

which returns path to the directory where your assembly (.exe) is running in.

Martin Cerman
  • 333
  • 2
  • 11
  • Is there any other way to create good installers .Because styling is not that much possible in Visual Stuidos – user3924730 Aug 24 '14 at 11:04
  • You can publish your application directly in Visual Studio, you just need to play with it for a while to get results you want. Here's a good guide that should help you: [link](http://msdn.microsoft.com/en-us/library/31kztyey.aspx) – Martin Cerman Aug 24 '14 at 11:09
  • The major drawback of Visual Studio publishing is that you can't choose the installation directory. It will always install to %appdata% folder as far as I remember (I haven't used it for a while). It has some nice features so you can definitely check that out if you don't mind the problem I said. – Martin Cerman Aug 24 '14 at 11:22