cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Marek22
Level 5

Advanced UI/Suite Detect Installed MSI Features

Hello,
I've created the suite installation that installs MSI with features. It allows user to select one or more features. Now I am creating major upgrade for this product and I need to upgrade only the features the user previously installed. However since the upgrade have new product code, the suite installer does not detect which features are installed and select all of them for upgrade. Is there any way how to detect the installed features or tell the msi to upgrade only what is installed?

I used technique described here for the original suite: http://blogs.flexerasoftware.com/installtalk/2013/01/configuring-package-features-from-a-suiteadvanced-ui-or-advanced-ui-installer.html

Many thanks,
Marek
Labels (1)
0 Kudos
(3) Replies
Marek22
Level 5

The solution was quite easy after all but for someone who is not experienced c++ programmer it can be tough. I created suite custom action where I detect which msi features are installed and set the suite feature action state accordingly.
It looks like:

[CODE] __declspec(dllexport) HRESULT __stdcall DetectUpgradePreviousInstalledFeatures(IDispatch *pDispSuiteUIExtension)
{
CComQIPtr spSuiteUIExtenstion = pDispSuiteUIExtension;
wchar_t productCode[255];

if(MsiEnumRelatedProducts(L"{MSIUPGRADECODEGUIDINBRACKETS}", 0, 0, productCode) == 0){
INSTALLSTATE featureState = MsiQueryFeatureState(productCode, L"FeatureName");

spSuiteUIExtenstion->put_Property(CComBSTR(L"FEATURE[FeatureName].actionState"), featureState == 3 ? CComBSTR(L"install") : CComBSTR(L""));
}

return S_OK;
}
[/CODE]

Of course there is need to add msi.h headder and add msi.lib to linker.
0 Kudos
TsungH
Level 12

Alternatively, one can set msidbUpgradeAttributesMigrateFeatures in Attributes column in Upgrade Table.
0 Kudos
Marek22
Level 5

TsungH wrote:
Alternatively, one can set msidbUpgradeAttributesMigrateFeatures in Attributes column in Upgrade Table.


This is also a solution for standard msi upgrade. But you cannot map the msi features to Suite features with only this set. Thank you for your reply.
0 Kudos