WIX: Prevent removing pre-existing files during uninstall - installation

The WIX installer I'm writing needs to install several operating system files in system folder. The program I'm writing this installer for is an old program... probably 10 years. I don't want it to replace any preexisting OS files on the user's machine. To resolve this, I figured I could use "NeverOverwrite="yes"
My problem is during the uninstall. I want the installer to ONLY uninstall the files it added. I don't want it to uninstall any pre-exisitng OS files the user already had.
Thank you

The installer should not delete files that it did not install (as Natalie commented), unless you specifically tell it to.
That said, when I need to install files directly to the system folder, I mark them as permanent so they never get uninstalled. Usually it's a Mircrosoft control or some OS file for which I don't have a separate redistributable installer, but if I had I wouldn't uninstall anyway.

Related

Unable to completely uninstall SOAPUI

when uninstalling the SOAPUI from windows 10 or windows 7 it will uninstall the application but the smart bear folder in c:/program files is not removed.
I am uninstalling soapui with the uninstaller.exe in the smartbear folder.
can anybody help me with any suggestions as to why the smart bear folder is not being deleted when we use the uninstaller
In general, any software installation, it keeps track of the file being installed. And the same files gets removed on uninstallation.
However, some softwares installation creates new files during that process. Apart from that, if software is used, some log files are created too.
But, when the software is uninstalled, it leaves the files those files that did not track (it may think that those are user files) and leaves them as is.
Since you know now that, those are files are not persisted by you, remove the remaining files safely.
The above mentioned is not just for this software, applicable for any software installed using installer, IMO.

Visual Studio Setup Project: How to delete all legacy files and folders in target folder before install my application?

I'm creating a Windows Installer (.msi) files by Visual Studio Setup Project.
When run .msi file, if target folder already existed and had some files and subfolders then how can i delete them before install my application ?
I have already searched but not found solution.
For an upgrade this should help:
https://www.red-gate.com/simple-talk/dotnet/visual-studio/updates-to-setup-projects/?_ga=2.123102924.696294303.1504290215-1234024276.1504290215
Basically update the setup project's version, accept changes, set RemovePreviousVersions to true when building your upgrade MSI. In addition (not in the article) you must increment the file versions of binaries that are being upgraded. This will do an uninstall of the older product as it installs the new version.
The post doesn't say where the temp files are, but if they are data files or temp files the app shouldn't be creating them in (say) the Program Files folder because it's not the recommended place (there are well defined folders for temp files, such as the Temp Folder), and it requires elevation to write/update files in Program Files so the app is therefore limited to admin users.
Uninstalls don't remove files created by the app (you wouldn't want an uninstall of Word to remove all your doc files) so it might be easier for the app to either not create them there in the first place, or remove them when it first starts up. The normal code solution for uninstalls would be an uninstall custom action in your older product that removes them, but if that old version is already shipped then it's too late.
Also, in a fresh install (even if it's an upgrade) the user could choose to install to another location, if you show the browse dialog to choose the Application Folder, and that means that the files are left in some orphaned Program Files folder, for example.

How to disable "Replacing Existing Files" features of windows installer?

Windows installer is replacing some files while starting the application. This is because these files versions are old as I replace them manually after installation. It's a configuration files.
I googled this issue and found that there's a feature in windows installer "Replacing Existing Files" that do this job based on file version.
Do anyone know how to disable this feature?
Repair is a normal feature of Windows Installer and you can't disable it. Windows keeps a record of the file versions that were actually installed and if it finds that they are wrong, then there are triggers that will cause their replacement. That includes right-clicking the MSI file and choosing repair, or doing a repair from Programs/Features, as well as some automatic entry points. The official way to replace just some files is with a Windows Installer mechanism such as a patch or an update/upgrade of some kind.
You don't say which tool you're using to build your MSI files, but the supported way to tell Windows you don't want it to manage your installed files is to use a null component id:
https://msdn.microsoft.com/en-us/library/aa368007(v=vs.85).aspx
and see the ComponentId description. That means you'll also need to remove them manually at uninstall time. Either you manage them or Windows Installer manages them. Or use a non-MSI setup to completely avoid the issue.

Msi Install issue on windows 7

I have crated Msi Installer using visual studio setup and Install project.My set up is working fine on some machine but on it works fine only when I am installing that set up using command prompt with admin privilege else installer completed but I am not able to see any file in programme file. So what can be issue?
I think Visual Studio generated MSIs behave badly when they require admin privilege but you don't use it. I think you'll find they install all the files to C:\ somewhere. The essential question is not if the files are there, oddly enough, but whether you see an entry in Add/Remove Programs (Programs&Features) because that means the install succeeded, because you don't mention an error the install rolling back. I think you are saying that there is an entry there.
Did you mark the install as for Everyone or Just me? That seems to make a difference, and I suspect you have a Just me install, which still means that you need admin privilege if you install to restricted locations. The Just me install does not mean a limited user can write to restricted parts of the system.

WIX uninstall error

Whenever I try to uninstall my WIX installation via Add/Remove Programs or the uninstall shortcut I put down with the installation, I keep getting the following error:
a network error occurred while attempting to read from the file c:\windows\installer\MyProduct.msi
But if I use the original installer and select uninstall then it is fine. Why is this happening as obviously you can't expect customers to hang onto the original installer if they need to uninstall my product!
After some testing it seems that if I install then uninstall straight away then it is fine, but if I log off or restart the computer then I get the error.
Update: Once an install is finished I run a custom action to delete a folder which temporarily holds some database files used during the install. After digging around it seems that the uninstall is trying to access these files, why would it be doing that, it has nothing to do with uninstallation?
"C:\Windows\Installer" folder is the Windows Installer cache. It's used to store MSI packages for installed products. These packages are used by Windows Installer when performing a repair or modify operation on the product.
In your case the uninstall process needs some files which are missing. The MSI in Windows Installer cache is not complete (it's just a stripped down version), so you are prompted for the original package.
Usually this behavior is triggered by custom actions which try to use files that are not available during uninstall. Try creating an uninstall log to see what triggers this.

Resources