Some questions about uninstallation actions and debugging

For all your non-technical questions.
sidj
Posts: 3
Joined: Fri Dec 10, 2010 1:29 pm

Some questions about uninstallation actions and debugging

Postby sidj » Fri Dec 10, 2010 1:51 pm

I am testing InstallAware this week as a potential replacement for Installshield. So far I haven't done anything special, but I like the emphasis on the scripting and how it's tied to the IDE. However, I am having problems figuring one thing:

How do I run actions during uninstall?
I create a file (or append to one if it already exists on the user's system) if a user selects a certain feature during installation. On uninstallation I want to delete this file (ideally I want to remove the two lines I added during installation, but I'm starting simple since I'll need the delete feature later anyway). I tried putting the Delete Files command in the Perform Uninstallation section, but that didn't work. During debugging, it would hit that code and go through it without deleting the file or giving any error code. I tried putting the same command in the install section:


Delete Files $CATIA19LOCATION$\$CATIAFILENAME$ (when uninstalling)

but this doesn't work either. In fact, during debugging, I get the error message: This installation is forbidden by system policy. Contact your system administrator.
Strange thing is that it will uninstall just fine from Add/Remove without giving that error (but still it doesn't delete the file).

Any help is appreciated.

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Re: Some questions about uninstallation actions and debuggin

Postby sinan » Fri Dec 10, 2010 2:42 pm

You should put that command in the installation section. Please read the help file topic "Setup Commands Preceding Apply Uninstall" for a detailed overview. Note that if you use the InstallAware Native Engine, things will work more intuitively (as you were expecting them to).

sidj
Posts: 3
Joined: Fri Dec 10, 2010 1:29 pm

Re: Some questions about uninstallation actions and debuggin

Postby sidj » Fri Dec 10, 2010 3:28 pm

Thanks for the reply Sinan. I already tried putting it in the installation sequence, but that didn't work. Since it seems from the help article that Windows Installer won't expand variables, I tried this:


Code: Select all

    Set Variable NATIVE_ENGINE to TRUE
    Delete Files $CATIA19LOCATION$\$CATIAFILENAME$ (when uninstalling)
    Set Variable NATIVE_ENGINE to FALSE


But this doesn't work either. If I do it this way, the script runs during installation itself, and the file never gets put there. This is the entire section (I probably have the command in the wrong place):

Code: Select all

 [DEFINE WEB MEDIA Catia19]
  Get Component PX\Catia19 Selection State into Variable SELECTED
  if Variable SELECTED Equals TRUE
    Read Registry Key HKLM\SOFTWARE\Dassault Systemes\B19\0\DEST_FOLDER_OSDS into CATIA19LOCATION
    Set Persistent Variable CATIAFILENAME to CATSysCtrlWNTN.ctrl
    if Variable CATIA19LOCATION not Equals ""
      Set Persistent Variable CATIA19LOCATION to $CATIA19LOCATION$\code\dictionary
      Write into Text File $CATIA19LOCATION$\$CATIAFILENAME$ from Value GeomagicFrame (at end of file)
      Write into Text File $CATIA19LOCATION$\$CATIAFILENAME$ from Value GeomagicAddinModule.dll (at end of file)
    end
    Set Variable NATIVE_ENGINE to TRUE
    Delete Files $CATIA19LOCATION$\$CATIAFILENAME$ (when uninstalling)
    Set Variable NATIVE_ENGINE to FALSE
    Install Files \\RAID\builds\Network\Studio\InstallAware\InstallDir\Parametric Exchange\CatiaR19\win_b64\*.* to $TARGETDIR$\Parametric Exchange\CatiaR19\win_b64, include subfolders
  end

mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Some questions about uninstallation actions and debuggin

Postby mills » Fri Dec 10, 2010 4:12 pm

The two engines, MSI and NATIVE, require a different order. In the MSI world, many of the commands need to appear before Apply Install, so that the MSI is aware of the action it needs to take during the Apply Uninstall (makes perfect sense, right?). Also, when using the MSI engine, the purple command are not executed immediately (as seen if debugging), but are queued up and executed when Apply Changes (Install, Uninstall, Patch) is called. The best way to see this behavior is like this:

Create a new project. Use Basic, Win32 or Win64 setup template. These are built around the MSI engine.
In the Design view, under the Advanced options tab, click on Services.
In the services view, click New->Control Service.
Choose one of the "on Uninstall" controls. In a real-world situation, you'd need to specify the service name, but for this exercise it's not necessary.
Once the service control is added, go into the MSIcode view.
Search (CTRL+F) for "control". You will find:

Code: Select all

    Control Service : stop on uninstall
    Apply Install (get result into variable SUCCESS)


The Native Engine works a little different. By default, the native engine executes the commands as they appear. So, if you wanted to use the Native Engine to issue the control service during UnInstallation, you would want to copy the line that was generated by the GUI to appear before Apply Install:

Code: Select all

    Set Variable NATIVE_ENGINE to TRUE
    Control Service : stop on uninstall
    set variable NATIVE_ENGINE to FALSE
    Apply Uninstall (get result into variable SUCCESS)


The same basic idea applies to delete files.
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.

sidj
Posts: 3
Joined: Fri Dec 10, 2010 1:29 pm

Re: Some questions about uninstallation actions and debuggin

Postby sidj » Mon Dec 13, 2010 12:53 pm

Awesome answer mills. Thanks a lot, that worked. I don't like to praise Installshield too much, but their help system really seems to be better than InstallAware. I think a bit more documentation about the various scripting calls and sample scripts would be very helpful for IA, especially because it's so heavily dependent on scripting. I already like it more than IS though, after just one day of testing.

bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Some questions about uninstallation actions and debuggin

Postby bokkie » Mon Dec 13, 2010 3:55 pm

sidj wrote:...I already like it more than IS though, after just one day of testing.


Yup! That's a hole-in-one for sure. It got me the same way. I was able to do more in a couple of days than I could have hoped to do in a couple of weeks using IS.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP


Return to “Non-Technical”

Who is online

Users browsing this forum: No registered users and 30 guests