PDA

View Full Version : Do components inherits Feature's destination ?



Pascal
05-31-2007, 04:48 AM
Hello,

I probably missed something but I don't see where is my problem...
I am working on a Basic MSI project. I have a feature which contains one component. I have a destination property for the Feature which is :
[INSTALLDIR]folder1
my component has [INSTALLDIR] as destination property.

If the destination at runtime is "c:\myfolder", my feature destination should be : "c:\myfolder\folder1".
the problem is that my component is installed in "c:\myfolder" which is INSTALLDIR.
How can I tell to my component to inherit of the feature's destination ?

Thanks in advance for any help provided.
Pascal

Holger_G
05-31-2007, 07:50 AM
Check the "Component’s Remote Installation Property vs. Feature’s Remote Installation Property " help topic section.

Or take a look here (http://helpnet.installshield.com/robo/projects/helplibdevstudio9/IHelpCompvsFeatRemoteInst.htm).

Pascal
05-31-2007, 09:12 AM
Thank you Nick but this topic apply to the source location of the data.
My concern is about the destination location.

Am I wrong ?

Holger_G
05-31-2007, 09:18 AM
Ups....sorry. I meant this (http://helpnet.installshield.com/robo/projects/helplibdevstudio9/IHelpCompDestination.htm).

Component's Remote Installation Property
Setting the component's Remote Installation property to Favor Source (or to Optional when the component's feature is set to Favor Source) means that the component's files will not be installed on the target system, regardless of the component's Destination property.

Feature's Remote Installation Property
Each feature also has a Destination property. If different, the component's Destination property overrides the feature's destination. The feature's Destination property is optional, but the component's is required.

Pascal
05-31-2007, 10:31 AM
Thanks Nick,

unfortunately, it seems that there is no way to do what I want to do :
http://helpnet.installshield.com/robo/projects/helplibdevstudio9/Destination_Using.htm
Here is an extract of the document pointed by the url :
If you want all the components in a feature to be installed to the feature's destination, you must set all of the components' destinations to match the feature's destination.

I think it is completely amazing or I have missed something in the concept.
If becomes impossible to share a component between two features. The first feature has to be installed in one location and the second feature in another location. If I specify the destination in the component's destination property, I cannot install it in another place :(

So my conclusion is that I have to duplicate my components if I want to install it in distinct locations.

Please, tell me I am wrong ;)

MichaelU
05-31-2007, 10:48 AM
Within a single installation, a single component can only be installed to a single location. The referenced page is trying to indicate it's easiest to change directories that are feature destinations. Depending on your end goal, there are several different approaches to resolving this.

If you are trying to install the file to one of two locations, configured at installation time, this can be done by setting the location of a directory identifier at runtime.

If you are trying to always lay down two copies of a file to two locations, the MoveFile table or DuplicateFile table (along with RemoveFile for uninstall).

If you are trying to support installing to different places in different installs, but only one per install (like a configurable merge module might), you may not have to do anything special.

DLee65
05-31-2007, 03:25 PM
Thanks Nick,

unfortunately, it seems that there is no way to do what I want to do :
http://helpnet.installshield.com/robo/projects/helplibdevstudio9/Destination_Using.htm
Here is an extract of the document pointed by the url :
If you want all the components in a feature to be installed to the feature's destination, you must set all of the components' destinations to match the feature's destination.

I think it is completely amazing or I have missed something in the concept.
If becomes impossible to share a component between two features. The first feature has to be installed in one location and the second feature in another location. If I specify the destination in the component's destination property, I cannot install it in another place :(

So my conclusion is that I have to duplicate my components if I want to install it in distinct locations.

Please, tell me I am wrong ;)

I have a similar situation where a path gets set at runtime. I would create a single feature with a default destination [ProgramFiles]\<MyCompanyName>\<AppName>. This will create a Directory with a default name {APPNAME} or something similar. Next I would create two (or more) custom actions to set a directory at runtime and set the condition so that it evaluates the feature action state. Look up in help under 'Conditional Statement Syntax' for more information on how to do this.

For example:
Feature1: Destination: [ProgramFiles]\Acme\A1\
Feature2: Destination: [ProgramFiles]\Acme\B2\

CommonComponent: Destination: {MYCOMPONENTDIR}[ProgramFiles]\Acme\A1\

Now your set directory custom action will only run if Feature2 action state is installstateLocal. The value you set it to will be the same value as Feature2 destination. In this case the component will ONLY install to one or the other location and not both.