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: Installing component parallel to the INSTALLDIR
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
‎Apr 26, 2011
05:39 AM
Installing component parallel to the INSTALLDIR
Hi
I have basic MSI project
Is there a way I can set up components to be installed in parallel to the INSTALLDIR ?
So in case the user choose to install under C:\COMPANY\MAIN ( which is the INSTALLDIR ),
several components will be installed under DIR2, like this
C:\COMPANY\MAIN
C:\COMPANY\DIR2
I have basic MSI project
Is there a way I can set up components to be installed in parallel to the INSTALLDIR ?
So in case the user choose to install under C:\COMPANY\MAIN ( which is the INSTALLDIR ),
several components will be installed under DIR2, like this
C:\COMPANY\MAIN
C:\COMPANY\DIR2
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2011
05:59 AM
For each component you also have "Destination" field.
Therefore, just type there the wanted location - in your case "C:\COMPANY\DIR2" instead of [INSTALLDIR]
If you dont want the components to have hard coded destination, then define your INSTALLDIR as : C:\COMPANY and then in the component destination field put
[INSTALLDIR]\MAIN or [INSTALLDIR]\DIR2
This way you can install different components to different destination regarding to your INSTALLDIR
Therefore, just type there the wanted location - in your case "C:\COMPANY\DIR2" instead of [INSTALLDIR]
If you dont want the components to have hard coded destination, then define your INSTALLDIR as : C:\COMPANY and then in the component destination field put
[INSTALLDIR]\MAIN or [INSTALLDIR]\DIR2
This way you can install different components to different destination regarding to your INSTALLDIR
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2011
08:19 AM
I guess I wasn't clear enough
the C:\COMPANY\MAIN was just an example it could be anything only the DIR2 folder is fixed.
To accomplish what I want I have a CA that get the parent of the INSTALLDIR
and using MsiSetTargetPath set the directory path to the components I need to install n parallel to INSTALLDIR
This work well but I wonder if there is a better way
the C:\COMPANY\MAIN was just an example it could be anything only the DIR2 folder is fixed.
To accomplish what I want I have a CA that get the parent of the INSTALLDIR
and using MsiSetTargetPath set the directory path to the components I need to install n parallel to INSTALLDIR
This work well but I wonder if there is a better way
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 26, 2011
12:52 PM
I don't how/if this would work in a Basic MSI project, but this is how I get it to work in InstallScript MSI. It takes the value of INSTALLDIR, clips off the last folder and replaces it with "MyFeature":
1) Set the Feature/Component Destinations for the feature(s) you want in "C:\COMPANY\DIR2" to a directory identifier called INSTALLDIR_MYFEATURE with some fake value (ex ##INSTALLDIR_MYFEATURE_FAKE##)
2) After Dlg_SdAskDestPath is called (where the user determines where they want your program installed), call this custom function by passing it the regular INSTALLDIR string:
Prototype:
Function:
3) the following line from that function is what sets the correct value for the Feature/Component destinations:
Again, I don't work with Basic MSI projects but hopefully this will give you an idea of how it can be done.
HTH
1) Set the Feature/Component Destinations for the feature(s) you want in "C:\COMPANY\DIR2" to a directory identifier called INSTALLDIR_MYFEATURE with some fake value (ex ##INSTALLDIR_MYFEATURE_FAKE##)
2) After Dlg_SdAskDestPath is called (where the user determines where they want your program installed), call this custom function by passing it the regular INSTALLDIR string:
Prototype:
prototype STRING MyFeature_GetMyFeatureInstallDir( byval STRING ); // szInstallDir
Function:
function STRING MyFeature_GetMyFeatureInstallDir( szInstallDir )
LIST lstInstallDir;
STRING svMyFeatureInstallDir, svPathPart;
NUMBER i;
begin
lstInstallDir = ListCreate( STRINGLIST );
// determine what value INSTALLDIR_MYFEATURE should have:
StrGetTokens( lstInstallDir, szInstallDir, "\\" );
svMyFeatureInstallDir = "";
for i = 0 to ListCount( lstInstallDir ) - 2
ListSetIndex( lstInstallDir, i );
ListCurrentString( lstInstallDir, svPathPart );
if svMyFeatureInstallDir != "" then
svMyFeatureInstallDir = svMyFeatureInstallDir + "\\" + svPathPart;
else
svMyFeatureInstallDir = svPathPart;
endif;
endfor;
svMyFeatureInstallDir = svMyFeatureInstallDir ^ "MyFeature";
MsiSetProperty( ISMSI_HANDLE, "INSTALLDIR_MYFEATURE", svMyFeatureInstallDir );
return svMyFeatureInstallDir;
end;
3) the following line from that function is what sets the correct value for the Feature/Component destinations:
MsiSetProperty( ISMSI_HANDLE, "INSTALLDIR_MYFEATURE", svMyFeatureInstallDir );
Again, I don't work with Basic MSI projects but hopefully this will give you an idea of how it can be done.
HTH
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)