I have a setup project with a custom installer class which launch the application at the end of the installation. In the setup, I create a shortcut to the output of the application. The installation goes fine. But when I click on the shortcut, the installer restart and the application launch at the same time? Why?
No, the code of my custom class is:
/// <summary>
/// Installer class to automatically launch the application at the end of the installation/
/// </summary>
[RunInstaller(true)]
public partial class InstallerStartApplication : Installer
{
/// <summary>
/// Initializes a new instance of the <see cref="InstallerStartApplication"/> class.
/// </summary>
public InstallerStartApplication()
{
InitializeComponent();
}
/// <summary>
/// Raises the <see cref="E:System.Configuration.Install.Installer.AfterInstall"/> event.
/// </summary>
/// <param name="savedState">An <see cref="T:System.Collections.IDictionary"/> that contains the state of the computer after all the installers contained in the <see cref="P:System.Configuration.Install.Installer.Installers"/> property have completed their installations.</param>
protected override void OnAfterInstall(IDictionary savedState)
{
base.OnAfterInstall(savedState);
}
// Override the 'Install' method.
public override void Install(IDictionary savedState)
{
base.Install(savedState);
}
// Override the 'Commit' method.
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
try
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
Process.Start(Path.Combine(Directory.GetCurrentDirectory(), "IERssNotificator.exe"), "-c");
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
// Override the 'Rollback' method.
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
}
I launch this at install and commit custom action.