cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SMM-OSSI
Level 3

Prompting User During Upgrade and Changing Options

Background:

  • VS 2015 C# WinForm application

    • Has multiple exe's in it that are packaged with the application
    • Has multiple custom drivers that are also packaged with the application
    • Testing by installing in a clean VM running Windows 7 Ultimate x64.


  • InstallShield 2015 Professional
  • InstalScript MSI project


One of the dialogs in our setup prompts the user with a list of all our drivers and allows them to select which to install. When reinstalling (using the same compiled setup file) this dialog automatically selects all the currently installed drivers and allows the user to install more or uninstall existing. This is currently working.

The problem comes when I try to upgrade. When I compile a new version of the setup file and run it on a VM that has an earlier version of the app installed, I need it to give the user a chance to again change/update their driver selection. I am able to get the message to appear as needed using the OnResumeUIBefore event, but when it actually runs the upgrade, nothing gets installed or removed the same as when they just reinstall. I am guessing that there's obviously some disconnect between the dialog I display and telling the upgrade engine to actually do it, but I cannot figure out how to do that. Again, I must point out that this same code appears in the OnFirstUIBefore and OnMaintUIBefore events and works fine in both of those.

If anyone can help, I would greatly appreciate it. Thanks in advance!

Here is my OnResumeUIBefore code:

function OnResumeUIBefore()
int nResult, nPrompt;
string szTitle, szMsg;
begin

Dlg_SdWelcome:

szTitle = SdLoadString(ISWI_RESUMEUI_TITLE);
szMsg = SdLoadString(ISWI_RESUMEUI_MSG);
nResult = SdWelcome(szTitle, szMsg);

nPrompt = MessageBox("This installer has detected a previous version of TheApplication. In addition to upgrading, " +
"do you wish to add to or modify the drivers that are currently installed?",
MB_YESNOCANCEL);

if (nPrompt = CANCEL) then
abort;
else

if (nPrompt = 7) then
// NO = 7.
goto Dlg_SdStartCopy;
endif;

Dlg_SdDriverOptionList:

szTitle = "Select the drivers you want to install.";
szMsg = "Select the drivers you want to install, and deselect the drivers you do not want to install.";

// _Drivers is a feature in InstallShield that contains sub-features - one for each driver.
nResult = SdAskOptionsList(szTitle, szMsg, "_Drivers", NONEXCLUSIVE);

if (nResult = BACK) then
goto Dlg_SdWelcome;
endif;

Dlg_SdStartCopy:

// Added in IS 2009 - Set appropriate StatusEx static text.
szMsg = SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_UPDATEUI );
SdSubstituteProductInfo( szMsg );
SetStatusExStaticText( szMsg );

Enable(STATUSEX);

endif;

end;
Labels (1)
0 Kudos
(1) Reply
chad_petersen
Level 9

I cannot help you directly with your question. However, it sounds like your case is perfect for the normal MSI (unscripted - Basic MSI) behavior.

First, Microsoft has a built-in Standard Action called FindRelatedProducts that is handy for upgrades.

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

Then there is a built-in capability called MigrateFeatureStates

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

So if you were to make each Driver its own top level Feature in a Basic MSI project then you could take advantage of all the goodness that MSI provides out of the box with no InstallScript at all. It gives you so much for free.

Of course, even with Basic MSI a person can still call InstallScript code, albeit slightly differently, to take advantage of anything needed there.

To make my projects more portable these days I have been coding any Custom Actions of my own design in C# DTF, but InstallScript is still fine.

But, I try to NEVER write a Custom Action for something for which there exists a Standard Action.

Anyways, not very helpful but perhaps food for thought?

Chad

0 Kudos