Hide the uninstaller in Add/Remove Programs?

2020-02-26 11:47发布

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.

4条回答
老娘就宠你
2楼-- · 2020-02-26 12:03

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
查看更多
甜甜的少女心
3楼-- · 2020-02-26 12:04

You don't know who his "users" are. This may not be for end-user software at all. We write a lot of custom software that's installed in a NOC; it doesn't put any uninstall info into add/remove. (We're using Nullsoft's NSIS and not the Visual Studio installer, btw...)

查看更多
家丑人穷心不美
4楼-- · 2020-02-26 12:06

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.

查看更多
淡お忘
5楼-- · 2020-02-26 12:19

It's way too silly to say something like "This is always a horrible idea". There are many cases in modern software where uninstalling dependencies can true and thoroughly f--- the machine at hand up.

Open Source Software ideals are only useful for people who WANT to be able to break their machine.

查看更多
登录 后发表回答