Page 1 of 1

How to control the execution order in the \"Run Programs\"

Posted: Tue Apr 07, 2009 3:43 am
by abware
Hi Guys,
I added few programs to be excuted after install but the installation program doesn't execute them in the same order that i have inserted them to the list. The order is very important for me.
Can i control it or its just randomally decides the excution order?

I'm using InstallAware express 8.

Thanks,
Adi Barda

Posted: Tue Apr 07, 2009 3:56 am
by bokkie
Adi,

1. Are you running them with the Wait For Program To Finish tickbox enabled? I'm not able to try and test anything at the moment but is it possible they are executing in the right sequence but finish at different times.

2. Are the programs all scheduled in the same block of code subject to the same conditions? I'm wondering that, if they are subject to conditions, they might not all be executing in the right sequence anyway?

3. (EDIT) Have you tried creating a basic setup as a test project and do nothing but run the programs? That would help to establish if they do run as expected and will help to establish if your main installation project is perhaps introducing an artificial runtime environment.

Those are just some ideas that come quickly to mind.

Posted: Tue Apr 07, 2009 4:22 am
by abware
Peter,
Thank you for the quick reply.
1. Yes, I'm using the "wait for program to finish" option
2. I'm not using any special conditions/variables

However one of the files is located in the Common directory while the other is in the Target directory. I need the file which is located in the Common to execute first.

Is it possible that InstallAware executes the files in the TargetDir first?

Thanks,
Adi

Posted: Tue Apr 07, 2009 5:25 am
by bokkie
Adi,

I'm not sure about that. What I'd suggest you think of doing is adding the executables you want to run to a file bag and execute them from there. That will eliminate executables being in more than one place and possibly will make the synchronisation more controllable?

Perhaps that will put you on track until someone else chips in with a better suggestion.

Posted: Tue Apr 07, 2009 8:07 am
by MichaelNesmith
It's very easy to specify order of execution - you just switch to the MSIcode view, and linearly order your Run Program statements in your script exactly as you need them.

Unfortunately since the Express version does not allow access to the MSIcode editor, this is not possible in editions lower than Developer.

Posted: Tue Apr 07, 2009 11:00 am
by abware
I understand but i woder what is the initial sorting you do for executing the programs is it by name, size, feature, folder or what? maybe i can workaround this issue.
currently i wrote small console application to control it and it works fine but i prefer to use the tool to do this things and not write my own patches.

Thanks,
Adi Barda

Posted: Tue Apr 07, 2009 4:00 pm
by bokkie
Adi,

You might want to download Microsoft's Orca and use that to open the MSI file and then you can see the tables. I don't recall how DOS commands are invoked but you might find a trace of them inside the MSI. Installers also use sequence numbers to change the order of events but I'm not entirely sure if it will be so obvious. As Michael wrote previously you can change the order in the MSIcode and that should, as I understand it, gaurantee the execution sequence.

Posted: Tue Apr 07, 2009 5:29 pm
by MichaelNesmith
The proper solution for you is to use an edition that supports scripting. The order is not deterministic when using the visual UI. You can ensure the timing (ex: before/after/finish dialog; install time/uninstall time), but not the order of items which have the same timing.

The InstallAware bootstrapper runs these files directly, so they won't be found in the MSI file.

Posted: Wed Apr 08, 2009 2:21 am
by abware
Thank you guys for your suggestions. I cannot afford extra 400$ at this point just for editing the script since my little product didn't start to sell. Anyway i would like to help all those who have the same problem. here is my C# script which do the work:

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace SetupComponentsOrder
{
class Program
{
static void Main(string[] args)
{
string currDir = Directory.GetCurrentDirectory();
for (int i = 0; i < args.Length; ++i)
{
string file = currDir + "\\\\" + args;
if (File.Exists(file))
{
try
{
execProc(file);
}
catch
{
}
}
}
}

private static void execProc(string path)
{
ProcessStartInfo pi = new ProcessStartInfo(path);
Process p = Process.Start(pi);
p.WaitForExit();

}
}
}


Simply compile it and put the program in your installation then execute it using the "Run Programs" feature and send in the command line parameters all your progrmas to be invoked in the correct sequence.

Hope it helps

Thanks,

Adi Barda

Posted: Wed Apr 08, 2009 6:15 am
by bokkie
Adi,

One thing to bear in mind about running .Net apps is to make sure you compile with the 'average' framework version which is currently 2.0. If you build your application using the 3.5 framework (VS.Net 2008) chances are it will fail on many machines unless 3.5 is pre-installed.

I don't know the IA express edition so I'm not sure if you can optionally select the prerequisites to be installed. You might want to check the registry to see what frameworks are installed or you can look for framework-specific files in the OS folders. You probably wont have a problem running a 2.0 or 1.1 framework compiled application but adopting a defensive approach has some value.