I have created a setup project using Visual Studio 2008. After the application is finished installing, I would like to have it start up immediately. Any thoughts on how this can be done?
3 Answers
I've used a script to place a checkbox "Launch [ProductName]" on the final form of the MSI. I cannot take any credit for the script though. You can find the script over on Aaron Stebner's blog at MSDN http://blogs.msdn.com/astebner/archive/2006/08/12/696833.aspx
There's an interesting article about it on CodeProject and some good answers there also (which is where I found Aaron's article). http://www.codeproject.com/KB/install/Installation.aspx
Finally, there's also some other similar questions on StackOverflow
How to run executable at end of Setup Project?
How to automatically start my application when my setup is done in C# setup project

- 1
- 1

- 14,253
- 6
- 54
- 63
-
+1 for Aaron Stebner's script. it worked in my VS2010 setup project. – Ben H Jun 15 '12 at 19:14
-
Aaron Stebner's script worked for VS2017 setup project – Sasha Sep 19 '18 at 08:30
-
Does anyone have this script and willing to re-post? It looks like the link is broken currently? – TChadwick Apr 12 '23 at 22:52
I have used a custom action in VS 2005. Not sure if this is enhanced in VS 2008.

- 51,744
- 26
- 128
- 170
Here's how to make your application launch after install (using VS2010):
Assuming you already have 2 projects like: MyApp.Application
and MyApp.Installer
.
- Right-click the project for
MyApp.Application
and chooseAdd
>New Item...
>Installer Class
(name it whatever you want) - Right-click the new Installer class & choose
View Code
Override the
Commit
method like this:public override void Commit(IDictionary savedState) { base.Commit(savedState); Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\MyApp.exe"); }
Update
MyApp.exe
to use the name of your application- Right-click your
MyApp.Installer
project & chooseView
>Custom Actions
- Right-click the
Commit
folder & chooseAdd custom action
- Choose
Application Folder
>OK
>OK
References:

- 13,095
- 11
- 75
- 91
-
This causes my installer to hang on installing, is there any fix to this? – Jack_b_321 Apr 14 '21 at 23:49