PDA

View Full Version : Suite Uinstall/Install as one install experience



rguggisberg
10-28-2015, 02:47 PM
Hi,

I am uninstalling in a Suite (in preparation for new install). I have not figured out how to get rid of the popup "Are you sure you want to completely remove 'xxxxx' and all of its features?" This is easily done for a Basic MSI package or an MSI package. Is there a way to do it for an InstallScript MSI Setup.exe package? I do have access to the InstallScript MSI packages and could modify them, but public properties are not available in OnUninstall.

I would like to make the uninstall of the old packages and the install of the new applications one install experience (upgrading without uninstalling will come later, but we have some very old packages for which that won't work).

My problem is the flow… I can detect that the package(s) are already installed and uninstall them; but have not figured out how to switch to install after uninstall is done. Has anybody done anything like that?

BTW, I am using IS 2013...posted a few questions over there recently, but does not seem to be much activity there.

Thanks for any ideas!

MarkusLatz
10-28-2015, 03:04 PM
Have you tried using a response file ?

https://flexeracommunity.force.com/customer/articles/en_US/HOWTO/Q209967

regards

Markus

rguggisberg
10-28-2015, 04:07 PM
Markus,
I tried a response file. That eliminates the user input, but is not a good choice because that does not remove the program from the ARP screen. Of course one could delete the registry keys for that... but that is even worse because then the Suite still thinks the package is installed!

Running the uninstall twice with the response file does get it removed from the ARP screen... but that's not a good solution :(

Edit 10/29/2015:
Figured out how to get rid of Confirmation pop up and Finish screen. Need to use the -uninst option to Setup.exe (to get rid of entry in ARP). Then also need to bring in OnUinstall event and edit to remove those things. It works out in my case because ONUninstall only gets executed with -uninst and I only use -uninst in Suite.

I still need to find a way to proceed with install after uninstall.
Thanks Markus!

DLee65
10-29-2015, 11:41 AM
I am not certain what type of package you are trying to uninstall; It sounds like it is a MSI package, but the reference to a response file seems to indicate this is an InstallScript package you are attempting to uninstall.
I had a scenario where we had an older package that was created with Wise Installer that I wanted to 'upgrade' during the install process.
I ended up creating a C++ custom action to handle the uninstall of packages prior to version 7.0, which is our first InstallShield version.

Here is the bulk of our C++ code:
AcRemovePkg.cpp


// AcRemovePkg.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include <windows.h>
#include <WinUser.h>
#include <Msi.h>
#include <iostream>
#include <atlstr.h>

using namespace std;
#import "..\..\..\Redist\Language Independent\i386\SetupSuite.exe" no_namespace raw_interfaces_only named_guids

// Prototypes
HRESULT __stdcall AcRemovePackage(IDispatch *pAction);
const int iGUID = 38;

HRESULT __stdcall AcRemovePackage(IDispatch *pAction)
{
DWORD pcchProductName = iGUID;
DWORD pcchMaxPath = MAX_PATH;
// reserve storage for the package location and Product code
BSTR upgradeCode = ::SysAllocStringLen(NULL, 2*iGUID);
BSTR bstrUpgradeCode(_T("UPGRADE_PROPERTY"));
LPWSTR lpProductCode = new TCHAR[iGUID];
LPWSTR lpProductPackageName = new TCHAR[MAX_PATH];

INSTALLUILEVEL orignalUILevel;
HRESULT hRet;
WCHAR wMsgBuf[1024];
const int iIncrement = 100;
const int iTicksMax = 1000;

const wchar_t lpCommandLine[]=L"REMOVE=ALL";

// Create a smart pointer to the IsSuiteExtension COM interface
CComQIPtr<ISuiteExtension> spSuiteExtension = pAction;
CComQIPtr<ISuiteExtension2> spSuiteExtension2 = pAction;
EnumProgressFlags pfProgress;
pfProgress = epfProgressValid;
//DebugBreak();
try
{
// Get the Product UpgradeCode from the Property
hRet = spSuiteExtension->get_Property(bstrUpgradeCode, &upgradeCode);
if (hRet != S_OK)
{
spSuiteExtension->LogInfo(L"Failed to locate UPGRADE_PROPERTY");
return(S_FALSE);
}
// Check to see if we have anything to upgrade (We should if we are here!)
UINT uProductCount = 0;
if(MsiEnumRelatedProducts(upgradeCode, 0, uProductCount, lpProductCode) == ERROR_SUCCESS )
{
if (MsiGetProductInfo(lpProductCode, INSTALLPROPERTY_LOCALPACKAGE, lpProductPackageName, &pcchProductName) == ERROR_SUCCESS)
{
wsprintf(wMsgBuf, L"ProductCode found is :%s", lpProductCode);
spSuiteExtension->LogInfo(wMsgBuf);
do
{
uProductCount += 1;
// we found so remove it
wsprintf(wMsgBuf, L"Removing product identified by :%s", lpProductCode);
// No UI Please
orignalUILevel = MsiSetInternalUI(INSTALLUILEVEL_NONE, 0);
// TODO: Send some message. Really should get this from the Install string table.
// TODO: This is not working yet
// spSuiteExtension2->SendProgressMessage(L"Remove prior install.....",iIncrement, iTicksMax, pfProgress);
UINT uRet = MsiConfigureProductExW( lpProductCode, 0 , INSTALLSTATE_ABSENT, lpCommandLine );
spSuiteExtension->LogInfo(wMsgBuf);
// UI Please
MsiSetInternalUI(orignalUILevel, 0);
// Keep processing until done
}while (MsiEnumRelatedProducts(upgradeCode, 0, uProductCount, lpProductPackageName) != ERROR_NO_MORE_ITEMS);
}
}
return(S_OK);
}
catch(std::exception& e)
{
std::wcout <<"Exception caught" << endl;
std::wcout << e.what() << endl;
return(S_FALSE);
}
return(S_OK);
}

dllmain.cpp


// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

AcRemovePackage.def

LIBRARY
EXPORTS
AcRemovePackage

This is used for uninstalling the previous version of the install during the Install of our newer InstallShield version of the package.
To configure this for the Suite I added the event to the 'OnPackagesConfiguring' event.
I set a condition on the event to 'MSI Upgrade', my Upgrade code, a Minimum and Max version (e.g., 1.0 Min, 6.9 Max) and made sure the flag for Include min and max are set to 'Yes'.

This process works reliably for us. Hopefully it can offer some help for you.

rguggisberg
10-29-2015, 12:09 PM
Thanks Dan!
We are using InstallScript MSI projects. Fortunately the Product Code has not changed, so I did get the uninstall behavior I need (get rid of Confirmation pop up and Finish screen) by using the -uninst option to Setup.exe (to get rid of entry in ARP). Then also brought in OnUinstall event and edited it to remove those things. It works out in my case because OnUninstall only gets executed with -uninst and I only use -uninst in Suite.

I still need to find a way to proceed with install after uninstall.

BTW, I have another Suite challenge and I see from posts that you have Suite experience. I don't want to gobber up this post with another subject, so I will add new post over on IS 2013 forum soon. Please check it out and LMK if you have any thoughts on that one.

Thanks again Dan