catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Why can't I uninstall something that has a custom action?

I ran into this problem while experimenting with custom actions.

My project has a custom action which is triggered during install. That action simply creates a file on my C: drive and writes a line to it.

The installation works fine, the file is created and correctly written to by the custom action.

However, when I run the uninstall from the Windows Add/Remove Programs utility I get a message like the following:

Exeption occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or
assembly 'file:///C:\Program Files\MyTestProject\TestCustomActions\
AdvancedInstallerUtility.dll' or one of its dependencies
The system cannot find the file specified.

What am I doing wrong?

Thanks,

cats

PS I have used the MS “Windows Installer CleanUp Utility” (see: http://support.microsoft.com/kb/290301)
to force the uninstallation so that I can continue testing.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Why can't I uninstall something that has a custom action?

Hi,

Since the custom action DLL is installed by the package, it can be used only when it is present on the machine. For the install process it can be used after the "InstallExecuteSequence" -> "InstallFiles" standard action and for the uninstall process before the "InstallExecuteSequence" -> "RemoveFiles" standard action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Re: Why can't I uninstall something that has a custom action?

Sorry, I still don't understand why a DLL which is only used at InstallExecuteSequence -> InstallFiles prevents the uninstall from working. Please note that I do not use a custom action at InstallExecuteSequence -> RemoveFiles.

Are you saying that because the .Net DLL is installed as part of the package that the package cannot be deleted?

Thanks,

cats
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Why can't I uninstall something that has a custom action?

Hi,

Does the custom action which uses the DLL have a condition? If you want to execute it only during install, the custom action condition should be:

Code: Select all

(Not Installed)
During an uninstall, the "RemoveFiles" standard action deletes the installed DLL. Therefore, the DLL is no longer accessible after "RemoveFiles" (any custom action which uses the DLL scheduled after "RemoveFiles" fails because it cannot find the DLL).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Re: Why can't I uninstall something that has a custom action?

No, the custom action did not have a condition, but when I added one (below), it corrected the problem and the uninstall works fine now.

For the record, here is what I did:

- selected the .NET custom action
- opened the Expression Condition, Edit Condition Dialog
- created the expression NOT (REMOVE="ALL")

Thanks Cosmin!

cats

Return to “Common Problems”