0

I have created a major upgrade (Installscript msi) which is running perfectly when executing by clicking on the exe file.

I am also creating a console aplication which runs the same exe but this time after installation, along with the new version, previous version is showing up in the add/remove programs list.

all components are installing correctly but

Why previous version is showing up only when I run the exe from console application?

// Enter the executable to run, including the complete path
start.FileName = @"folder1\MyISProj.exe";
// Do you want to show a console window?
start.CreateNoWindow = true;
start.WindowStyle = ProcessWindowStyle.Minimized;

start.UseShellExecute = false;
start.RedirectStandardOutput = true;

// Run the external process & wait for it to finish
using (Process proc = Process.Start(start))
{
   //proc.WaitForExit();
    proc.Close();
}

One more thing I have observed is, when I call exe from console application the installer will open and after accepting EULA and etc, when actual installation start then the console application is getting called again. To stop this behavior I have added a check in Main method to run the console application only once. Now when installer try to run the console applicaiton again it will check whether the process is already running, if yes it just returns from the console application.

Process[] result = Process.GetProcesses();

foreach (var item in result)
{
    if (item.ProcessName.Contains("MyISProj"))
    {

        Console.WriteLine("There is already a instance running.");
        System.Environment.Exit(0);
        return;
    }

}

But after doing this also add/remove program list shows two entries. What I have to do to solve this issue? I am stuck with this issue.

I am using InstallShield 2011 professional edition to create exe.

PSR
  • 875
  • 2
  • 13
  • 37

1 Answers1

0

There are two problems here. First is that you don't have a valid Major Upgrade as evidenced by two entries in Add/Remove Programs. You've changed the ProductCode but the Upgrade table entry (as executed by FindRelatedProducts and RemoveExistingProducts) isn't detecting the previous installation and removing it as part of the upgrade. There are a number of causes of this which can be found from googling.

The second is that InstallScript MSI silent installations are a royal pain in the backside. They require you to generate a response file and then run with it. This is very brittle and a big reason why I suggest staying with Basic MSI which is a much simpler story to support. ( msiexec /I foo.msi /qn REBOOT=R and check for 3010 exit code indicating a reboot was needed and suppressed. )

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • MsiGetProperty(ISMSI_HANDLE, "ISACTIONPROP1", szOldProductValue, nProSize); is returning previous existing product code. It is working fine when I execute the "exe" by clicking on it but the issue coming when I run the same exe from console application. Mine is not silent installation. I am just calling the exe as shown in the code. It is exe not msi so I am not able to use msiexec. – PSR Jul 23 '13 at 03:32