Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy MySQL server with VisualStudio 2005 application

I have a Visual Studio 2005 project (C#) that uses MySQL as a data storage engine, i would like to create a MSI package that install the app, and after install MySQL silently. I have been looking into it but i couldn't find much info.

I have installed the MySQL package silently and after configure it with this two statments in the CMD

Install:

msiexec /qb /i "c:\mysql.msi" /l* d:\log_mysql_test.txt INSTALLDIR=d:\mysql_test_mdps

Configure:

D:\mysql_test_mdps\bin\MySQLInstanceConfig.exe -i -q "-lD:\mysql_config_log.txt" "-pD:\mysql_test_mdps\bin" "-tD:\mysql_test_mdps\my-template.ini" "-cD:\mysql_test_mdps\my.ini" -v5.5.9 ServerType=DEVELOPMENT DatabaseType=MIXED ConnectionUsage=DSS Port=53306 ServiceName=MySQL_AGM RootPassword=root1234 SkipNetworking=no AddBinToPath=yes

But now i don't know how to say Visual Studio taht do it before or after it install my application. I have been googleing it, but i couldn't find any usefull help.

I hope you can guide me :)

EDIT: I have been working around the solution with custom actions, i've found this article that use a custom installer class to carry the custom actions. It looks fine at first place but i'am getting a problem because when my MSI package try to launch the second MSI installer (the MySQL) i get an error with code 2869 that says "Access Denied".

I've been looking for this problem as well and look like when the first MSI is trying to run the second MSI it don't apply the right privileges and the installation fails...

Do you know what can i do? or how can i launch the second MSI installer? with full privileges (or at least the same as the first installer)

this is the code i'm using to create the Process object.

string arg1 = "/qb /i \"" + filepath + "\" /l* \"" + Path.Combine(installpath, logfile) + "\" INSTALLDIR=\"" + installpath + "\"";

Process p = new Process();
p.StartInfo.FileName = "msiexec.exe";
p.StartInfo.Arguments = arg1;
p.Start();
like image 876
SubniC Avatar asked Feb 11 '11 12:02

SubniC


2 Answers

You dont need to start another msiexec.exe. Visual Studio also lets you use an executable as a custom action. So the custom action

See below. Image is from this link: Custom Action

Check out the Calling an executable as a custom action section in above link. Now if this does not work other way out is to modify the default bootstrapper.

Check out the reply by 0xA3 in this link.
Running another program from c# setup project

And its not complex as it looks. :)

Some more links for adding prequisites to bootstrapper:
Authoring a Custom Bootstrapper Package for Visual Studio 2005
Visual Studio Setup & Deployment: Adding Pre Requisits

Plus you should take a look at this:
MYSQL installation with a .NET winforms app

like image 74
Aseem Gautam Avatar answered Oct 04 '22 21:10

Aseem Gautam


Are you using the Visual Studio Installer? If so, you've to go to click with the right mouse button on the Installer (in the Solution Explorer), then go to View and click Custom Actions on the context menu.

A new tree with the Custom Actions should appear on the center of the screen. Then, you can right-click any of the folders (depending on when you want to add the action) and choose Add custom action...

Hope this is helpful for you...

like image 40
Jaime Oro Avatar answered Oct 04 '22 21:10

Jaime Oro