Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide the uninstaller in Add/Remove Programs?

I am creating windows installer project using Visual Studio 2005.

Is there an option make it so that my project does NOT have an uninstall option in Add/Remove programs?

One of my customers has asked me to do this.. Here's Why: Because the installer is a patch to an existing program. After uninstalling, the program no longer works because the patched files get uninstalled. Instead of figuring out a way to restore the replaced files (which we haven't been able to do with this installer), we're wondering if it is possible to disable the uninstall.

like image 233
jm. Avatar asked Jan 20 '09 20:01

jm.


2 Answers

You just need to set ARPSYSTEMCOMPONENT=1 in the Property table of the installer using Orca (Can't be done directly in Visual Studio from what I know)

This is commonly used when a program installs dependencies and you don't want the user to uninstall dependencies by hand, they need to use a specific uninstall script you've provided or something.

Personally, I would author the patch as a patch and prevent the patch from being uninstalled.

Also I suggest picking up a copy of The Definitive Guide to Windows Installer which will give you some explanation on how, why and where you should use tricks such as this. As well as giving you a really good understanding of the windows installer fundementals and help you to design a better installer in the long run. All the examples in the book use Visual Studio + free tools from the Windows Installer SDK.

Edit: The user still has full control to uninstall via MSIEXEC, via a custom uninstall shortcut that you provide, all this does is hide the entry in Add/Remove Programs (ARP)

Edit2: Sample VBS to add the property (if you want to do so as part of an automated build process)

Dim installer, database, view

Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase ("test.msi", 1)

Set view = database.OpenView ("INSERT INTO Property(Property.Property, Property.Value) VALUES('ARPSYSTEMCOMPONENT', '1')")
view.Execute

Set database = Nothing
Set installer = Nothing
like image 91
saschabeaumont Avatar answered Nov 02 '22 23:11

saschabeaumont


There might be, but to be honest, that's a horrible, horrible idea. It's not your call to tell a user what they can and cannot do with their machine.

And if the user shouldn't have the ability to do so, then that is usually determined by an administrator and the user is not given the right to uninstall anything by virtue of their account type, which again, is not something you should have influence on.

like image 29
casperOne Avatar answered Nov 03 '22 01:11

casperOne