0

I created a Basic MSI installer project with InstallShield 2016 professional using the project assistant. I did not created any components/features (just the deafulkt features has been created). The installer should run a console application first (I added as part of the installer, but it won't be installed) and, if no errors arise, simply copy a WPF application (DLLs and .exe) to the client location.

Ideally the steps would be, after the interview dialogs proposed:

  1. Prompt the used if he/she want to proceed
  2. If [no] close the process, if [yes], display a custom dialog accepting three fields for a SQL connection string
  3. Then, with the given parameters as input, run the console app. The console app just runs some SQL scripts, but it will not be installed and it is part of the installer
  4. After this step (how can I check it is finished and no errors occurred?) copy the files (wpf .exe and DLLs) as set in the project assistant.

In the documentation I read that with custom actions it is possible to run executables, but I cannot understand or find details on how to pass parameters (except from command line) to the console application or to get the final status produced by the console application.

Can anyone suggest me how can I achieve those steps?

UPDATE

In InstallShield it is possible to create properties among custom actions and then call those values like: [PropertyName] in other places where needed.

I could do this to add the three properties for the executable command line parameters:
i=[DB_CONN_INSTANCE_NAME] u=[DB_CONN_USER_NAME] p=[DB_CONN_PWD]

2
  • @Slava did not have time to recheck the answer since your update. I accepted it ;) Commented May 12, 2017 at 14:07
  • Glad, it worked out for you. Best regards. Commented May 12, 2017 at 14:09

2 Answers 2

1

how can I check it is finished and no errors occurred?

Your console application should return ExitCode. 0 (zero) would indicate success and any other number would be failure. Inside your custom action (CA) properties you should choose "Synchronous (Check exit code)" for "Return Processing" property. As you want to run this CA at installation time, you should choose "Deferred Execution" for "In-Script Execution" property. You should write condition at least because you want this happen only during installation, and not when user will remove the product, are you? In this case complete "Install Exec Condition". If you set all of the above I believe the MSI Type Number for this CA will be 1026.

where I can find some more detailed documentation?

Here you go: Custom Actions

EDIT:

If I test the application I do not get any hint that the console app ran. Plus how can I then specify to proceed with the second custom function (that should install the WPF app) if the executable is successful?

You need to set "Install Exec Sequence" in order to run your CA at the certain time. The deferred type of CA has to be scheduled somewhere after "InstallFiles". More on how to schedule CA read over there: Sequencing Custom Actions. When you schedule your console app CA with "Synchronous (Check exit code)" property, installer will wait while your CA exits and only after that continue sequence. Your second CA should be scheduled after the first CA. Very simple, you are definitely on the right track.

Is it possible to debug the steps for a Basic MSI?

I am not sure what are you asking over here. As far as I understand you are using InstallShield Studio, so run debug and step through. If you ask about debugging CA itself you should look at the following resource: Debugging Custom Actions

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the info. I created a custom dialog to get the input parameters into variables that I then use as parameters for the custom action executables, using the settings you suggested (MSI Type number 1042, I do not need it to run on unistall). If I test the application I do not get any hint that the console app ran. Plus how can I then specify to proceed with the second custom function (that should install the WPF app) if the executable is successful? Is it possible to debug the steps for a Basic MSI?
1

You can refer to this link on Run custom program during installation

4 Comments

thanks for the link, it gave me a good hint on where to start, but my case is slightly different. I cannot give command line parameters with the setup (they are parts of a SQL connection string), I update the question to reflect the details.
@Luca Then you don't need to invoke them from the command line. Just create a windows forms or WPF app. Use the executable file as a custom action. Add that custom action. That action could handle the message for confirmation and a form for entering the details. Then using the custom action app, run the scripts you want to run. Then initiate the installation from thereon.
In my project, I have the WPF exe linked to the "IS_LAUNCH_MY_PROGRAM_PLEASE" custom action (created by default during the project assistance steps). I added a custom dialog to get the DB connection from the user. I created a custom action with "NEW EXE" and I select my consoleApp.exe where in its command line property, I set the above properties (like user=[IDS_USER]). I am still missing how can I call this custom action when the "Install" button (In the ReadyToInstall dialog) is clicked.
I tried to add "DoAction" as new Event, with Condition = 1 and Action Value the name of my custom action but at run time I get the error 1721. There is a problem with the Windows installer package. A program required for this install to complete could not be run. Action: myActionName.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.