PDA

View Full Version : Force Feature to install if condition is met during major upgrade



jasonaunrein
12-05-2016, 01:31 PM
I'm trying to add the ability to out upgrade process to configure the system for a test environment vs production if a certain file is present in the system (for ease of the testers). I am not having much luck in getting this to work. This is a for a major upgrade wrapped in a setup.exe.


I first tried setting the feature to conditionally install but if the feature wasn't install during the full install, it won't attempt to install during the major upgrade. I've tried a variety of different options but it has not worked yet.
I'm now trying to use a custom action to force it to install by using vbscript
Session.FeatureRequestState("Test_Environment") = 3. That is generation application errors during the install and I'm not seeing much in the way of doing it other than how I'm currently doing it.


I'm looking for any advice on how to accomplish this since I'm still learning about all the bells/whistles of installshield.

fwiw, here's my entire script

Option Explicit

Function isGoodStr(x)
isGoodStr = False
If vbString = VarType(x) Then
If 0 < Len(x) Then
isGoodStr = True
End If
End If
End Function

If isGoodStr(Session.Property("TESTINSTALL")) Then
Session.FeatureRequestState("Test_Environment") = 3
End If

This script runs synchronously/Immediate Execution. I have it configured to run After ValidateProuctID and I've tried also doing it right before CostFinalize

This is the current error I'm receiving when running the install

MSI (s) (34:3C) [10:26:36:990]: Doing action: SetTestEnvForInstall
Action ended 10:26:36: ValidateProductID. Return value 1.
MSI (s) (34!3C) [10:26:37:600]: Note: 1: 2731 2: 0
Action start 10:26:36: SetTestEnvForInstall.
MSI (s) (34:5C) [10:27:53:240]: Product: New Leaf Rx -- 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 SetTestEnvForInstall script error -2147467259, Msi API Error: FeatureRequestState,Feature Line 13, Column 2,

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 SetTestEnvForInstall script error -2147467259, Msi API Error: FeatureRequestState,Feature Line 13, Column 2,
Action ended 10:27:53: SetTestEnvForInstall. Return value 3.
Action ended 10:27:53: INSTALL. Return value 3.


Note: If I try to set the install level to 0 per the remarks for FeatureRequestState, that line will bomb with a similar error

chad.petersen
12-16-2016, 03:33 PM
Something does not sound right here. I add new Features and Subfeatures to my Major Installers with almost every major release and they upgrade the existing Features/SubFeatures and add any new ones to the system. Existing ones are brought forward using MigrateFeatureStates, which should run automatically during an upgrade is it finds something with FindRelatedProducts.

MigrateFeatureStates
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370034(v=vs.85).aspx

FindRelatedProducts uses the Upgrade table:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa368600(v=vs.85).aspx


If you remove the Condition completely as a test from the new Feature you are adding does it install then - and only not install when you have the Condition set? If so, your Condition might just need to be reversed with a NOT in the proper location.

Possibilities perhaps?

Chad