views:

99

answers:

2

This is probably a stupid question and my Googling just is not functioning today.

I have an application I added a Visual Studio Installer > Setup Wizard project to. I am wondering how to add a button or check box that would launch the application after successful install. This would be located on the last page of the MSI Installer Package. I am using Visual Studio 2010 Ultimate.

I am needing this so that when the application does an automatic update, it auto launches the installer. I just need the installer to relaunch the app after the update.

This is probably very simple but for the life of me I cannot figure it out. Thanks in advance for you help.

+1  A: 

To run any application after the installation is complete, right-click on your setup project, click on Custom Actions. Then right-click on Commit, Add Custom Action, and choose the file you would like to run. Note that it has to be in your application folder already, which shouldn't be a problem in your case since you are running your program anyway. Simply choose the output of your project.

Then, click on this added .exe, and change InstallerClass to false. This is crucial because it will look for an installer program otherwise.

You could even pass parameters to your .exe by adding them to the Arguments property

sbenderli
Excellent..one question, would the main app be considered 'Primary output from ApplicationName (Active)'?
ThaKidd
Yep that is correct
sbenderli
Perfect, thank you so much!
ThaKidd
You're welcome.
sbenderli
One problem. The install app starts my app but never closes until I exit my app. It gets stuck on "98%" and only finishes when I exit my app. Is there a way to shutdown the installer gracefully?I ensured I set InstallerClass to False. Is there something I am missing?
ThaKidd
aah yes that will happen...in my case that was acceptable. what you can do instead is run a script from your installer which will in turn run your app and exit. this way, your app will run, but the script will exit which will let your installer complete also.
sbenderli
+1  A: 

Try checking out this blog post: http://blogs.msdn.com/b/astebner/archive/2006/08/12/696833.aspx

I can't attest for if it works for 2010 or not; I'm still stuck using 2008 until my TFS server gets upgraded. Also, I use WiX for my installers. But, it's just a custom action, so I think it should still be supported.

Hope this helps!

(By the way, while practicing my googling to find this, your question was showing up on the first page of Google for this question.)

fire.eagle
Heh. It didn't give me that "Someone else has answered" popup at the top. I suggest using sbenderli's solution. Much simpler than the blog post.
fire.eagle
Thanks! I am thinking of looking into WiX as I have read some good stuff about it.
ThaKidd