Manoj Pandey
Manoj Pandey

Reputation: 257

How to write custom action to delete an installed file before install finalize

I want to write a custom action that will delete an installed file before installation is finalized, i.e after I install file "test" from msi.

I am executing it. Now I want to delete this file after it is executed. I have written a custom action for execution of "test" file. How should I write a custom action for deleting it?

Upvotes: 2

Views: 2337

Answers (2)

Cosmin
Cosmin

Reputation: 21426

This is not recommended because Windows Installer may detect the missing file and try to repair it. Instead, you can try this approach:

  • store the file in Binary table
  • use a custom action to extract it in a temporary location when installation starts
  • use another custom action to remove it at installation end

To extract the file you can use the Windows Installer API. You also need a DLL or VBScript custom action which receives the installation handle. Perhaps this tutorial will help: http://www.codeproject.com/KB/install/msicustomaction.aspx

Upvotes: 1

digor_ua
digor_ua

Reputation: 592

You can use C# for custom action development. Set according Walkthrough in MSDN

Upvotes: 1

Related Questions