Question

I have a Setup Project which uses a System.Configuration.Install.Installer Class forhandling some custom actions. My logic in the Uninstall method was throwing an exception (null reference exception to be exact) which causes the uninstallation to exit without actually uninstalling anything.

I know what is causing the issue and changed the code in the Uninstall method, but it doesn't matter because if I try to uninstall the program via the Control Panel, it won't have the changes I made so it will continue to exception out, and if I try to uninstall via the context menu of the Setup Project in VS2010, it doesn't seem to use the rebuilt Setup Project and does the same thing which happens trying to uninstall via the Control Panel.

I feel like I'm caught between a rock and a hard place. Has anyone else fallen into this situation, and if so, how do you circumvent it?

Was it helpful?

Solution

This Question answered my question perfectly.

Basically, I just recompiled the System.Configuration.Install.Installer dll file without any logic in the Uninstall method. Manually replaced the dll located in the program's install location with the newly compiled one, and then tried to uninstall the program again. The uninstaller will use the new dll file and won't throw an exception (because I removed all my code from that method).

I was then able to fix my code and make a new installer.

As a just in case, I threw all my uninstall logic into a try block and am catching Exception which you can argue is bad, but at least it keeps any changes I make to the method from crashing the uninstallation process (for me, it just means some configuration files might get left behind not cleaned up properly).

OTHER TIPS

You can try recaching the fixed MSI by using this command (where you use the actual MSI path):

msiexec.exe /fv <path_to_new_msi>

You can also try using MsiZap.exe from Windows SDK:

http://msdn.microsoft.com/en-us/library/aa370523(VS.85).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top