Start Application Automatically After Setup

October 5th, 2005 by Jim Shank Leave a reply »

I wanted to automatically run my application after setup completed. I searched high and low for this option and it just isn’t included in the Setup Project options for Visual Studio.NET 2003. It looks like it will be in 2005 though. Here is the easy way to do it

  1. Add an installer class to your application with the following code:
    Public Overrides Sub Install(ByVal stateSaver As IDictionary)
    MyBase.Install(stateSaver)
    Dim Asm As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly
    System.Diagnostics.Process.Start(Asm.Location)
    End Sub
    
  2. Right click on your setup project and go to View – Custom Actions
  3. Right click on Install under Custom Actions and select Add Custom Action…
  4. Select the primary output of your project from the application folder
  5. Do the same for the Commit

That’s it. Your installer will now run your application after setup.

Advertisement

Leave a Reply

WordPress Appliance - Powered by TurnKey Linux