cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
varnkken
Level 3

Disable feature install based on another feature (no UI Dialogs)

I have a basic MSI that is fully automated where there are no user dialogs presented. The MSI must decide on features to install based on current registry values.

I have about 15 features in which all are disabled by default (install level 0) with the exception of one feature (lets call it Feature_X) which is set to install level 1. There is one feature (lets call it Feature_Y), that if enabled, Feature_X cannot be installed.

I am using condition statements on al features, except Feature_X to set the install level to 1 if the registry condition is met. However, if Feature_Y condition is met, I need to have Feature_X disabled.

Sound confusing? You bet.

So the bototm line is, how can I dsiable one feature if another one is selected? I have tried using the &Feature_Y<>-1 approach in Feature_X condition, but it does not seem to work.
Labels (1)
0 Kudos
(7) Replies
tschley
Level 3

Why not add a conditional statement to Feature_X and set the install level to 0 if the registry value exists (the value for Feature_Y)?
0 Kudos
varnkken
Level 3

After I posted, I thought of that very same thing.

I guess it would still be nice to have some way of doing it off of another feature install level as well.

In my case it worked out ok to use the same condition from Feature_Y to set Feature_X to 0.

I guess it could get out of control if several feature conditioons needed to be met in order for another feature install level to be set to 0.
0 Kudos
cspanellis
Level 3

Hi,

I am trying to modify a web.config for to change a connection string for a database, but that file will only exist if they choose a certain.

So far I've realized that I have to have custom code to modify the config since it's an attribute that I'm changing and not an element (which I could do easily through the XML settings interface). So I created a script to do so.

Now I can only modify that file if it exists, and it will only exist if they have chosen that feature. So I created a custom action for that script, and I need to know how to set the condition properly so it will only run After the files have installed and if that feature has been chosen.:confused:

Thanks!

Chris
0 Kudos
varnkken
Level 3

I think this is a bit off topic from the original post.

Not sure if this is what you are looking for, but in your custom action vb script you can check to see if the feature is enabled. If it is enabled, then you can run your Web.Config XML modify code.

Option Explicit On
Const msiInstallStateUnknown = -1

Function CheckInstallCondition()
Dim ret
Dim view
Dim record
Dim name
Dim state

view = Session.Database.OpenView("SELECT Feature FROM Feature")
view.Execute()

record = view.Fetch

If not record Is Nothing Then
name = "Name of your feature goes here"
state = Session.FeatureRequestState(name)

If state <> msiInstallStateUnknown Then
rem Feature is Enabled. Run web.config modify code here.
End If

CheckInstallCondition = ret

End Function
0 Kudos
tschley
Level 3

You could use the Install Exec Sequence to control when the custom action executes. Then, the custom action could check for the existence of the file before running the script.
0 Kudos
cspanellis
Level 3

I'm sorry, you are correct about it being off topic, but it came close so I added my question here.:)

Your response helps immensely. The only other thing I need is how to check what the value of the database properties of the installer are from vbscript (i.e. IS_SQLSERVER_SERVER)

Thanks again for your help!
0 Kudos
cspanellis
Level 3

I figured it out. Thanks again for the help.
0 Kudos