Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > after Installation launch the windows application.
 

after Installation launch the windows application.

I implemented auto launch the application using this Installer class

using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.Diagnostics;
using System.Windows.Forms;
using System.Reflection;
using System.IO;

namespace SimpleCodec
{
[RunInstaller(true)]
public partial class InstallerClass : Installer
{
public InstallerClass()
{
InitializeComponent();
this.AfterInstall += new InstallEventHandler(AfterInstallEventHandler);
}
private void AfterInstallEventHandler(object sender, InstallEventArgs e)
{
try
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Mysoftware.exe");
}
catch
{
// Do nothing...
}

}
}
}

It will launch the application automatically after installation is over but before the clicking of "close" button of installation process.

I want application launch will be after the close of installation process. Please share any idea how to achieve it.

ak
  • Moved byHarry ZhuMSFTMonday, August 10, 2009 2:11 AM (From:Visual C# Language)
  •  
Iniyan  Thursday, August 06, 2009 2:12 AM
Hi Iniyan,

Based on my experience, custom action made in VS cannot accomplish that task, if you want to do that, you will need to use Orca and code script to do this. That was a painful work and you need to do it each time when you build a new version.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Monday, August 10, 2009 9:02 AM
Installer classes do not run in the application context, so it's not clear to me what GetExecutingAssembly will return. You're running with the SYSTEM account on an msiexec.exe process. See this thread about TARGETDIR and the recommendation to not do this.
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9b9e0dba-f2e5-4b2e-9fe0-d6aa51434ebf
Phil Wilson
PhilWilson  Monday, August 10, 2009 11:51 PM

You can use google to search for other answers

Custom Search

More Threads

• how to: update a webform application from the web
• Windows Installer Shortcuts point to strange targets
• Looking for Permissable & Safe Location to store data files
• Multiple scripts in Post-Build event
• Re: Version information on the first page of install
• MDAC Prerequisite
• Where is ClickOnce App?
• How to change the ClickOnce Publisher Name ?
• What is the correct way to do impersonation in a click-once deployed app?
• CustomAction code doesn't execute