Search code examples
c#windows-10wixuninstallationaddremoveprograms

App visibility in "Apps & Features" and "Programs & Features" for one user but not another


I've created a C# app for Windows 10. It is installed via an MSI generated with WIX. When it is installed for one user on a machine, though, through no intention of my own, it is not installed for other users on the same machine.

This behavior is actually fine (though unplanned), but the problem comes on uninstall.

If two users install it, and only user-a uninstalls it, it gets fully uninstalled for user-a, and becomes broken for user-b. User-b will still see it listed in "Apps & Features" in the Settings app, but all files in "C:\Program Files (x86)" will have been removed, so it will not run at all.

The solution I'm going for is this. When user-a uninstalls it, all that should happen (if user-b also has it installed) is the listing should be removed from the Settings app under "Apps & Features" and also from the Control Panel under "Programs & Features". No files should be removed from "C:\Program Files (x86)".

This should be possible, since, when only installed by one user in the first place, the files at "C:\Program Files (x86)" are all there for both users, but only the user who installed the app sees it listed in Settings or in the Control Panel.

My question is, how do I only remove the links to the app from Settings > "Apps & Features" and also from Control Panel > "Programs & Features" for just one user?

I've seen that there are ways to remove the listing for both users without uninstalling the app, such as altering/deleting the registry entry at:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

...but that is not my goal. I just want to be able to remove the listings for only one user, while keeping the listings for all other users.

If I knew how the listing could be there for one user and not for another, I could probably figure out how to make my app cause that to happen. But I'm not sure what populates these two program lists in the first place, or what would make them different for different users.

I hope this made sense! Thanks in advance for any assistance you can offer!


Solution

  • Set Package/@InstallScope="perMachine". That ensures there's one copy and it's shared by all users on the machine.