This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Setting a directory dynamically in execution sequence (basic msi project)
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 29, 2009
05:31 AM
Setting a directory dynamically in execution sequence (basic msi project)
Hi
In a basic MSI project (!) we need to dynamically set a directory. The directory is usually (depending on some settings) outside the normal InstallFolder and is DestinationPath for a component. As silent installation needs to be supported, i tried to set the directory in the execute sequence. Unfortunately, i am still struggling with this and i havent come up with a solution yet. Here is what i tried to do:
1. Define a folder path ( "CP_DYNAMICFOLDER") and a property ("C_DYNAMICPROPERTY")
2. Under "Files and Folders" i create a new directory "myFolder" with the directory identifier set to "CP_DYNAMICFOLDER"
3. I set the Destination path of the component that i want to have installed in the dynamic directory to "[CP_DYNAMICFOLDER]"
4. I create a custom action fill that returns the path for dynamic folder (the actual logic is rather complex and includes registry entries, config files, existing folders. ) The custom action sets the previously created property C_DYNAMICPROPERTY to the return value of the custom action. In the execute sequence, the custom action is (synchronously) executed after "RemoveIniValues" in "Deferred Execution in System Context" mode.
5. Next i use a custom Action "Set Directory" (MSI Type Number 35) to assign the value of the dynamic property ( Directory value ("[CP_DYNAMICFOLDER]") to the dynamic folder (directory name ( "CP_DYNAMICFOLDER") . This custom action is executed synchronously in Immediate Execution mode (not possible to choose anything else) right after my custom action that returns the folder path.
Now, as you can imagine. This does not work at all, but i dont see what is wrong and how else i could possibly achieve my goal. I believe the "Set directory" custom actions does not do what i want it to (one indication it has to run in immediate execution mode") My questions are:
- Is my goal possible at all? I fear changing the directory dynamically is only supported in ui mode. However, we also need to support silent installation?
- Is what i did ok but i made a silly mistake (spelling, missing [] or superfluous [])?
- If i would like to try to use msi built in "MsiSetTargetPath" instead of "Set directory" function, how could i do this. Do i have to directly edit the Table"InstallExecuteSequence" or to i have to use InstallScript (i would like to avoid both if possible)?
- What do i have to be aware of when placing the concerned custom action(s) in the execute sequence. I believe i have to place it somewhere between "InstallInitialize" and "CreateFolders"
- What do i have to do to make this work?
Thanks in advance and greetings
In a basic MSI project (!) we need to dynamically set a directory. The directory is usually (depending on some settings) outside the normal InstallFolder and is DestinationPath for a component. As silent installation needs to be supported, i tried to set the directory in the execute sequence. Unfortunately, i am still struggling with this and i havent come up with a solution yet. Here is what i tried to do:
1. Define a folder path ( "CP_DYNAMICFOLDER") and a property ("C_DYNAMICPROPERTY")
2. Under "Files and Folders" i create a new directory "myFolder" with the directory identifier set to "CP_DYNAMICFOLDER"
3. I set the Destination path of the component that i want to have installed in the dynamic directory to "[CP_DYNAMICFOLDER]"
4. I create a custom action fill that returns the path for dynamic folder (the actual logic is rather complex and includes registry entries, config files, existing folders. ) The custom action sets the previously created property C_DYNAMICPROPERTY to the return value of the custom action. In the execute sequence, the custom action is (synchronously) executed after "RemoveIniValues" in "Deferred Execution in System Context" mode.
5. Next i use a custom Action "Set Directory" (MSI Type Number 35) to assign the value of the dynamic property ( Directory value ("[CP_DYNAMICFOLDER]") to the dynamic folder (directory name ( "CP_DYNAMICFOLDER") . This custom action is executed synchronously in Immediate Execution mode (not possible to choose anything else) right after my custom action that returns the folder path.
Now, as you can imagine. This does not work at all, but i dont see what is wrong and how else i could possibly achieve my goal. I believe the "Set directory" custom actions does not do what i want it to (one indication it has to run in immediate execution mode") My questions are:
- Is my goal possible at all? I fear changing the directory dynamically is only supported in ui mode. However, we also need to support silent installation?
- Is what i did ok but i made a silly mistake (spelling, missing [] or superfluous [])?
- If i would like to try to use msi built in "MsiSetTargetPath" instead of "Set directory" function, how could i do this. Do i have to directly edit the Table"InstallExecuteSequence" or to i have to use InstallScript (i would like to avoid both if possible)?
- What do i have to be aware of when placing the concerned custom action(s) in the execute sequence. I believe i have to place it somewhere between "InstallInitialize" and "CreateFolders"
- What do i have to do to make this work?
Thanks in advance and greetings
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 29, 2009
08:43 AM
As I understand it, the Execute sequence executes immediate actions on its first pass. At that time, it writes deferred actions to a script, then it runs the script.
So, your "set a directory" CA is actually getting run first, even though it is scheduled later than the deferred CA.
Does your CA that generates the path make any system changes? If not, is it possible that you could run that as an immediate action instead of deferred?
So, your "set a directory" CA is actually getting run first, even though it is scheduled later than the deferred CA.
Does your CA that generates the path make any system changes? If not, is it possible that you could run that as an immediate action instead of deferred?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 29, 2009
09:24 AM
Also, is it an option for you to put the set-directory action in both the UI and Execute sequence? (Performing MSI validation on the built project can help catch scheduling errors.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 30, 2009
07:05 AM
Hi
Thanks for your answers. As suggested, i had to set the execution mode to immediate. Here the steps that worked for me:
1. Define property ("C_DYNAMICPROPERTY")
2. Under "Files and Folders" create a new directory "myFolder" with the directory identifier set to "CP_DYNAMICFOLDER"!
3. Set the Destination path of the component that you want to have installed in the dynamic directory to "[CP_DYNAMICFOLDER]"
4. Create a custom action that returns the path for dynamic folder and thus sets the previously created property C_DYNAMICPROPERTY to the return value. In the execute sequence, the custom action is (synchronously) executed after "InstallationIni" in "Immediate Execution" mode.
5. Next, create a custom Action "Set Directory" (MSI Type Number 35) to assign the value of the dynamic property ( Directory value ("[C_DYNAMICPROPERTY ]") to the dynamic folder (directory name ( "CP_DYNAMICFOLDER") . This custom action is executed synchronously in Immediate Execution mode as well (not possible to choose anything else) right after my custom action that returns the folder path.
6. At this point the folder directory is already properly set. The folder now has to be assigned to a component’s destination-> Set the components destination to the dynamic folder. Example: [CP_DYNAMICFOLDER]anttherSubfolder\subsubFolder . (its probably easiest to browse to the location.)
Regards
Thanks for your answers. As suggested, i had to set the execution mode to immediate. Here the steps that worked for me:
1. Define property ("C_DYNAMICPROPERTY")
2. Under "Files and Folders" create a new directory "myFolder" with the directory identifier set to "CP_DYNAMICFOLDER"!
3. Set the Destination path of the component that you want to have installed in the dynamic directory to "[CP_DYNAMICFOLDER]"
4. Create a custom action that returns the path for dynamic folder and thus sets the previously created property C_DYNAMICPROPERTY to the return value. In the execute sequence, the custom action is (synchronously) executed after "InstallationIni" in "Immediate Execution" mode.
5. Next, create a custom Action "Set Directory" (MSI Type Number 35) to assign the value of the dynamic property ( Directory value ("[C_DYNAMICPROPERTY ]") to the dynamic folder (directory name ( "CP_DYNAMICFOLDER") . This custom action is executed synchronously in Immediate Execution mode as well (not possible to choose anything else) right after my custom action that returns the folder path.
6. At this point the folder directory is already properly set. The folder now has to be assigned to a component’s destination-> Set the components destination to the dynamic folder. Example: [CP_DYNAMICFOLDER]anttherSubfolder\subsubFolder . (its probably easiest to browse to the location.)
Regards
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 30, 2009
08:09 AM
Hi,
and what about
C_DYNAMICPROPERTY in step 5
?
and what about
C_DYNAMICPROPERTY in step 5
?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 30, 2009
09:01 AM
Shame on me, that was a mistake and i corrected it directly in the post. I hope its clear now.
Greetings
Greetings
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)