views:

1543

answers:

4

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.

+3  A: 

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.

casperOne
+2  A: 

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...)

Joe
Since this isn't really answering the question that was asked, it should probably be a comment and not an answer.
EBGreen
Probably, but Joe doesn't have a high enough reputation to leave a comment.
Chuck Phillips
Aah...good point.
EBGreen
I do now. Thanks! :)
Joe
+4  A: 

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
sascha
I just don't see how to modify the property table from the Visual Studio installer.
jm
Missing closing paren on:Set view = database.OpenView ("INSERT INTO Property(Property.Property, Property.Value) VALUES('ARPSYSTEMCOMPONENT', '1')")
jm
Also add this line before "Set database = Nothing":database.commit() ' Seems to be required?
jm
I've never needed database.commit(), I think thats only required if you've opened a transaction initially.
sascha
fixed the closing paren - thanks jm :)
sascha
+1  A: 

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.