Can anybody help me.
I have special application (configurator.exe) for configuring our product. Application developed on C#.
My application should detect if it were started during installation or manyally by user.
I've implemented such code for this (which worked fine in VS setup project):
Code: Select all
[RunInstaller(true)]
public partial class StudioInstaller : Installer
{
#region · Constructors and destructors ·
public StudioInstaller()
{
InitializeComponent();
}
#endregion
#region · Protected methods ·
public override void Install(IDictionary stateSaver)
Globals.ProgramRunningMode = ProgramRunningMode.Installation;
bool exceptionOccured = false;
bool canceledByUser = false;
try
{
// ...
if (exceptionOccured)
{
if (canceledByUser)
throw new InstallException("Canceled by user");
else
throw new InstallException("Error occured");
}
base.Install(stateSaver);
}
catch (Exception ex)
{
throw new InstallException(ex.Message);
}
I've also tried to write something like this:
Code: Select all
if (exceptionOccured)
Application.Current.Shutdown(2000);
Can somebody help me?