kithkanan
Posts: 21
Joined: Mon Jul 13, 2009 11:28 am

Running a .exe file

Hi,

I have a Web App that requires a database for it to run. I used a third party (Red Gate SQL Packager) tool to create a .exe file for me for database installation. I added it as Temporary File in my project. I then, created Custom Action "RunAsAdmin" with the following Properties:

Source Path: <AI_CUSTACTS>aicustact.dll
Source Type: Executable.exe
Command Line: [&sqldata.exe] -> this points to my .exe file created by SQL Packager

Execution Property: Synchronous Execution, check return code.

Execution Option: Immediate execution

Scheduling Option: Always Execute


Then, in my Dialog Page, I added a New Event under "Published Events" on the "Next" button of FolderDlg (I want the database installation to take place before the installation of the package starts). This event points to the Custom Action "RunAsAdmin" and has the following property:

Event: DoAction
Argument: RunAsAdmin
Condition: AI_INSTALL

But when I run my installer (after building it), the installation failed with the following error:

"There is a problem with this Windows Installer Package. A program required for this install to complete could not be run."

I checked my .exe (sql packager) file and it was not corrupted. When I double-clicked it, it run.

By the way, the sql packager exe file prompts the command line before running (maybe this info could be helpful).

Am I missing something?

I really need your help.

Thanks! :)
kithkanan
Posts: 21
Joined: Mon Jul 13, 2009 11:28 am

Re: Running a .exe file

Just a follow up questions, how would I know if my .exe file has finished running? The installer package should only run if the database was successfully created.

Thanks again! :)
kithkanan
Posts: 21
Joined: Mon Jul 13, 2009 11:28 am

Re: Running a .exe file

I used EXE with working Dir instead of RunAsAdmin, and my .exe file now is running. My remaining problem is how to disable "Next" button of installer once the SQL Packager exe is running and enable it again if the Database was successfully created. If the user Cancels the Database installation, the installer should quit as well.

Attached here is the image of SQL Packager Database Installation Interface

Any help will be highly appreciated.

Thanks a lot! :)
Attachments
Database Installation Interface
Database Installation Interface
package.png (12.27 KiB) Viewed 11445 times
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Running a .exe file

Hello,
But when I run my installer (after building it), the installation failed with the following error:

"There is a problem with this Windows Installer Package. A program required for this install to complete could not be run."
To run an executable with Administrator privileges you need to:
- set the RunAsAdminFile installer property to the full path of the file that needs to be launched
- optionally set RunAsAdminCmd and RunAsAdminWorkingDir properties
- set DoAction RunAsAdmin on your 'Next' button's Published Events tab as described here
I used EXE with working Dir instead of RunAsAdmin, and my .exe file now is running. My remaining problem is how to disable "Next" button of installer once the SQL Packager exe is running and enable it again if the Database was successfully created. If the user Cancels the Database installation, the installer should quit as well.
In order to Enable/Disable the “Next” button, follow these steps:
- select your “Next” button, and then select the “Control Conditions” tab
- press “New” and set your condition to IS_OK = “Yes” and set Action to Enable
- press “New” again, set your condition to IS_OK = “No” and set Action to Disable
The result should be:

Code: Select all

CONDITION                      ACTION
IS_OK = "Yes"                  Enable
IS_OK = "No"                   Disable
- with your button still selected, switch to the “Published Events” tab
- press “New”, in the Name field select “SetProperty” and replace it with “RunAsAdminFile”
- fill in the Argument field with the full path to your sqldata.exe, [APPDIR]sqldata.exe if your database installer is in your application's directory (sqldata.exe must be a temporary file)
- immediately below, add your DoAction RunAsAdmin event
- you will need to program your own custom action (let's call it Detector) that constantly checks if the database installation was successful, and set the windows installer's IS_OK property to “Yes” or “No” accordingly, then exit.
- add the DoAction Detector action after RunAsAdmin
- make sure your Detector action has the “Synchronous Execution, check return code” execution property selected.
- below you will have the NewDialog VerifyReadyDlg action already set. You will have to change its condition to IS_OK=”Yes”
Overall, your Published Events tab for the Next button should look like this:

Code: Select all

EVENT                  ARGUMENT                   CONDITION
SetTargetPath          APPDIR                     1
[RunAsAdminFile]       [APPDIR]sqldata.exe        AI_INSTALL
DoAction               RunAsAdmin                 AI_INSTALL
DoAction               Detector                   AI_INSTALL
NewDialog              VerifyReadyDlg             AI_INSTALL AND IS_OK = “Yes”
Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
kithkanan
Posts: 21
Joined: Mon Jul 13, 2009 11:28 am

Re: Running a .exe file

Hi,

Thanks for your reply. I'll try your suggestions :)
kithkanan
Posts: 21
Joined: Mon Jul 13, 2009 11:28 am

Re: Running a .exe file

Hi again,

Can you please further elaborate on how to do this? I can't seem to make it work.
set the RunAsAdminFile installer property to the full path of the file that needs to be launched
Here's what I did:

On Command line field of RunAsAdmin property, I clicked edit. Then Windows Installer Property and clicked New. At the Name field i put "RunAsAdminFile" and to Value I have [APPDIR]sqldata.exe and then OK. The final value on my Command Line field is "[RunAsAdminFile]".

But when I run the installer, the error pops out again.

And also, if you don't mind, can you please tell me on how do I do this?
you will need to program your own custom action (let's call it Detector) that constantly checks if the database installation was successful, and set the windows installer's IS_OK property to “Yes” or “No” accordingly, then exit.
Sorry, but I'm really new to these kind of stuffs.I hope you understand.

I really appreciate your help.

Thanks!
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Running a .exe file

Hello,
Here's what I did:

On Command line field of RunAsAdmin property, I clicked edit. Then Windows Installer Property and clicked New. At the Name field i put "RunAsAdminFile" and to Value I have [APPDIR]sqldata.exe and then OK. The final value on my Command Line field is "[RunAsAdminFile]".

But when I run the installer, the error pops out again.
- when creating a property, its value cannot be set to another property
- you have to set your RunAsAdminFile property by selecting your 'Next' button on the Dialogs page, then selecting the "Published Events" tab and making sure you have the following settings there:

Code: Select all

EVENT                  ARGUMENT                   CONDITION
SetTargetPath          APPDIR                     1
[RunAsAdminFile]       [APPDIR]sqldata.exe        AI_INSTALL
DoAction               RunAsAdmin                 AI_INSTALL
DoAction               Detector                   AI_INSTALL
NewDialog              VerifyReadyDlg             AI_INSTALL AND IS_OK = “Yes”
- make sure you are installing sqldata.exe as a temporary file in the Application Folder.
And also, if you don't mind, can you please tell me on how do I do this?
I am afraid we do not have a sample code for this. You can create your custom action by using a .dll made in C++ or a VB Script.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
kithkanan
Posts: 21
Joined: Mon Jul 13, 2009 11:28 am

Re: Running a .exe file

Thanks a lot for the clarification :)

Return to “Common Problems”