elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

I can not use Session.FeatureRequestState in inlinescript

Hi

I am trying make some simple inline script with using Session.FeatureRequestState and it always failed with error:

Code: Select all

Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor.  Custom action PreferFirewallThanProtocolscan script error -2147467259, Msi API Error: FeatureCurrentState,Feature Line 1, Column 1,  
What I am trying is very similar to this: http://www.advancedinstaller.com/forums ... t=0#p21849
except that I want to set feature not property

Code: Select all

If Session.FeatureRequestState("feature1") = 3 And Session.FeatureRequestState("feature2") Then Session.FeatureRequestState("feature1") = 2
I simplified it in order to find where is problem on this simple command.

Code: Select all

msgbox "state" & Session.FeatureCurrentState("feature1")
and it also doesn't work. And I am sure that feature1 exist in Feature table. I have no idea what is wrong.

please help,
thanks
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: I can not use Session.FeatureRequestState in inlinescript

Hello,

Just make sure "feature1" is the identifier, not the feature's display name.
Select the feature from the Organization page and look in the right pane. Make sure the indentifier field contains "feature1"
Also, make sure your custom action is set to Immediate.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Re: I can not use Session.FeatureRequestState in inlinescript

Hi

Yes, I checked it many times if this is correct feature name. And after some fails I started changing it directly over Orca so I can see that I am using feature identifier.
And this CA Runs from Begin of InstallExecuteSquence where has to be set on Immediate execution.

But now I am trying it from DLL and MsiGetFeatureState returns ERROR_UNKNOWN_FEATURE. So I don't understand where is problem :(
There has to be some another problem.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: I can not use Session.FeatureRequestState in inlinescript

Hello,

In your vbscript, you need to call:

Code: Select all

Session.SetInstallLevel(0)
before requesting the feature state.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Re: I can not use Session.FeatureRequestState in inlinescript

Hi

Finally I solved it. Problem was something else and initialization

Code: Select all

Session.SetInstallLevel(0)
wasn't necessary. Maybe in DLL custom action but in VBS it is working now without it.

So problem was that I called this CA too early and it has to be called after costing actions. Here is citation from msdn for error 2731 which occur during my tests.
The selection manager is responsible for determining component and feature states. It is initialized during the costing actions ( CostInitialize action, FileCost action, and CostFinalize action.) A standard action or custom action made a call to a function requiring the selection manager before the initialization of the selection manager. This action should be sequenced after the costing actions.
So I shifted this CA after CostFinalize and it work now.

Thanks,
regards, elanius.

Return to “Common Problems”