PDA

View Full Version : How to disable a feature.



PilotBob
07-16-2004, 05:21 PM
I have followed the documentation and put a condition on a feature. The level of the feature is changed to 200.

This works, and the feature shows as "Not Available" in the custom setup dialog. However when the user is able to turn the feature back on. Is it possible to disallow the user from turning the feature back on?

Thanks,
BOb

RobertDickau
07-16-2004, 07:50 PM
The only thing I can think of, offhand, is conditionally setting the feature's install level to 0: this deselects and hides the feature.

PilotBob
07-17-2004, 07:56 AM
Hmm... when I do that I get this build message:

Val0005: A condition for feature 'Reports' may possibly set the InstallLevel for this feature to zero at runtime. If this feature gets enabled on install, you must author similar logic to ensure that it is also enabled in maintenance mode, otherwise in an upgrade the feature will be ignored.

Should I worry about this?

Is there a different condition for install as opposed to maintenence mode. Basically, it is a feature that is only installed if the current machine has Crystal RAS installed on it.

Thanks again,
BOb

gcmvanloon
07-29-2004, 04:46 AM
PilotBob, Have you found a sultion for your requirements?

I want to do about the same thing you tried to do...
I don't want to hide the feature because the user must be made aware the feature exists. The feature can only be installed when visual studio is installed. I can do a systemsearch for visual studio but I can't diable (gray out) the feature to show it's there but can not be installed bcause the install condition for that feature is not met. The feature discription could tell the user what the install condition is...

Thanx

PilotBob
07-29-2004, 08:21 AM
Basically I saw three options.

1. Have the condition set the install level to 200... Then it showed as disabled, but the user could still select it.

2. Have the condition set the install level to 0, then it was totally hidden.

3. Have the condition set the install level to 200, but also put conditions on all the components in the feature to the same condition so even if the feature is selected, the components don't install. But, I didn't really like this option.

HTH,
BOb

gcmvanloon
07-30-2004, 02:21 AM
Ok, we will just have to choose one of these three options then. I was hoping there was a better solution.

Thanx!

Tony Dixon
08-03-2004, 08:35 AM
there is a better way.

you can remove the feature from the tree when the test condition is true.



// this function will remove the named featuer if the install is run on a NT system.
Function RemoveFeature()
STRING szData;
begin

szData="";
if(SYSINFO.WIN9X.bWin9X )=FALSE) then
FeatureSetData (MEDIA, "Feature1", FEATURE_FIELD_SELECTED, FALSE, szData);
endif;
end;

gcmvanloon
08-04-2004, 07:45 AM
I Disagree to use Installscript in order to remove a feature from the feature tree. The same thing can be done by setting the INSTALLLEVEL property to 0 when a condition evaluates to true.

I would have used INSTALLLEVEL when I wanted to hide the features but I don't want to hide them. Then my users would never know that the feature is there. I would rather gray out the feature and tell the user what conditions has to be met in order to enable the feature.

As I understand, this can not be done and I decided to place conditions on all components of the feature.

DLee65
02-03-2006, 01:46 PM
This can be done, and I do it for my InstallScript setups.
First I create a dummy feature and set RequiredFeatures property to the feature path of the item I have visible but disabled. Make sure the visible property of the dummy feature is set to false.

This works for InstallScript projects, I am not certain of MSI projects.