/build/static/layout/Breadcrumb_cap_w.png

How do I delete a file during installation of an MSI package?

I would like to be able to delete an arbitrary file from the disk from within an MSI package. It needs to sequence before the uninstallation of the previous package.

As far as I understand at the moment, I would need to create a row in the CustomAction table, and the relevant entry in the InstallExecute table of the MSI.

In the InstallExecute table, I have sequenced this action just before the RemoveExistingProducts action.

In the CustomAction table, I have defined an action, but don't know what information to use for the 'Type', 'Source' and 'Target' columns.

Many thanks,
Steve

0 Comments   [ + ] Show comments

Answers (4)

Posted by: anonymous_9363 15 years ago
Red Belt
0
Steve,

It's clear from your questions that you're using Orca/InstEdit to directly edit the MSI tables. These tools are great for established packagers but, for those who are on the learning curve, it makes the uphill climb steeper than it needs to be. I would strongly advise that you persuade your client/employer to spring for one of the established MSI-authoring tools from Altirs (Wise PackageStudio et al) or Acresson (InstallShield AdminStudio et al). In the meantime, both vendors have trial versions available for download.

As to your question, the colum entries you mention depend on what "technology" you intend to use to delete the file. Is it VBScript? A batch/command file? An EXE?
Posted by: essdeeay 15 years ago
Senior Yellow Belt
0
Thanks for the reply VBScab,

It's a long story, but there's no way my team leader will authorise buying a fully-fledged package editor. It's depressing I know - but I won't go into internal politics here!

What about a simpler way... I've written a python 10-liner and converted it to an .EXE (20Kb). I could configure this to run after the pre-install checks have succeeded and before the removal of the previous product. I think I've cracked it - it's trying to run, but failing with the error:

[blockquote][font="courier new"]Error 1722.There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action delfileRun, location: C:\Documents and Settings\Administrator.TECHNOLOGY\Desktop\9.1 MSI\, command: C:\Documents and Settings\Administrator.TECHNOLOGY\Desktop\9.1 MSI\delfile.exe
[/blockquote]
I'm sure it's just a minor setting I've missed somewhere. Here's a quick description of my .MST and an image showing the transform table:

  1. Created [Feature] entry
  2. Created [Component] entry
  3. Created [FeatureComponents] entry and linked feature/component
  4. Created [File] entry and linked to component
  5. Created [Media] entry to copy CAB containing file
  6. Created [CustomAction] entry
  7. Created [InstallExecuteSequence] entry




I don't have permission to upload any files, but if necessary, I've uploaded the Acrobat Reader MSI and my MST files.

Many thanks,
Steve
Posted by: jmcfadyen 15 years ago
5th Degree Black Belt
0
probably would be better to use the RemoveFile table than a CustomAction. This runs prior to installation taking place usually.

seems to me the cost of a real editor would be outweighed by the time you have already investigated working this out.

on another note it seems your trying to run the file from a users profile which can be problematic if you haven't validated your msi correctly. You may be better off in this instance using the binary table to execute your CA if you intend to follow the CA path.
Posted by: essdeeay 14 years ago
Senior Yellow Belt
0
Hi jmcfadyen,

I have a little script in INSTALLDIR which I call in the [InstallExecute] table (along with a few related settings in other tables), at sequence 1425, *just* before the "RemoveExistingProducts" action at 1430. The "RemoveFiles" action isn't until 3500. Anyway, it works like a dream now.

Thank you all for your replies and help - I've certainly learnt a lot.

Many thanks,
Steve :)
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ