WIX installer remove all the files when uninstalling from control panel - wix

i have created an MSi installer. when i install this installer it also installs a visual studio project which is actually a tutorial project. When user runs this project it generates Bin and Obj folders. when i uninstall the install it does not delete all the those Bin and Obj folder which are generated after the installation.
Can you provide me some example how to use RemoveFolder tag in Wix to remove those two folders and the files inside them recursively.
Thanks

RemoveFile will only remove files that are installed by this msi.
To remove entire folder you have to use util:RemoveFolderEx. To use it you have to:
- Store [TARGETDIR] in registry on install;
- Retrieve it on any actions except on install and store in local variable (using RegsitrySearch)
- Add util:RemoveFolderEx action to your main component and pass your stored path variable to the Property attribute.
If you need an example I could write it for you.

Related

Specify directories to not be removed on uninstall

I have a WiX installer for an app that can generate two folders while running. I'd like these two folders to not be removed on uninstall however. I'm using RemoveFolderEx to remove the entire install directory, but wasn't sure if there was a way to exclude folders from being removed.
I've tried using a Custom Action with a PowerShell script to move the folders out of the directory, but this solution would rely on the script being somewhere outside of the install directory in order to be run before the folders are removed, and doing this unfortunately gets rid of the installer's portability.
Have you tried setting the msidbComponentAttributesPermanent attribute on the required Component(s) to make them permanent?
https://learn.microsoft.com/en-us/windows/win32/msi/component-table

Wix bundle uninstall package with custom install location

I have a Wix bundle which allows users to customize installation directory and passes the value to the package during installation. This is implemented using the approach described in this answer: How do I pass a default 'install location' to the RtfLicense bootstrapper?
If the user does not change install directory after running bundle and uninstalling it all files are deleted as expected. If the user does select another installation directory and runs bundle and uninstalls the app the files are not deleted. I guess this happens because the bundle passes default directory but it obviously isn't there. What's more the shortcut that's created during installation is deleted as the shortcut location does not depend on the installation directory.
How can I solve this issue?
The "install location" is not saved by the bundle. The packages have to save anything they need upon installation and read it back during other operations. For an MsiPackage, this is typically done using the "Remember Property" pattern. Directory paths are manipulated as properties so save any directory paths you need.

Howto create Directory in Temp Install Dir for Custom Action

I've got an C# Wix Custom Action which is reponsible for setting up Datatabase.
All needed Dlls are extracted during Installation into C:\windows\installer\currentinstalldir.
So thats fine. The needed Sql Files are in the same Directory, but they have to be copied to
C:\windows\installer\currentinstalldir\sqlscripts.
I've found a way to get what i want.
This code used as PostBuild Function does what i need.
%wix%SDK\MakeSfxCA.exe “$(TargetDir)$(TargetName).CA$(TargetExt)” “%wix%SDK\x86\SfxCA.dll” “$(TargetPath)” “$(TargetDir)Microsoft.Deployment.WindowsInstaller.dll”
Found on buildmaestro
But due to a limitation of cmd.exe (max Chars) I could not add all files I need.
My Workarround ist to Install these Files as a hidden feature and pass the Directory via Install Property to my Custom Action.

WiX: Copy a file from local folder to installation folder

I'm using a WiX setup project to build an MSI package.
I want the MSI, to do a copy of the given file during the installation to the installation folder from the one, where the .msi file is running from.
I read on WiX a bit, and what I found is the <CopyFile... /> element supposed to do that.
Appreciate your help.
Actually I've figured out what the issue is.
The problem is that the SourceDirectory of the CopyFile element supposed to point to the Directory tag id.
Instead, I've used SourceProperty attribute of the CopyFlie tag, and also defined a Property separately, which made the use of the CopyFile element correct.
So it worked.

How to use WIX CopyFile element to copy file on change/repair to a system folder without installing it to the target?

I have a problem which is related to the execution of CopyFile on change/repair when using WIX to make a msi setup.
I have a feature which has a component which copies/moves a file from the source folder to a folder already present somwhere inside a users system. It is not the folder of my application. I am only moving this file and not installing it to the the target. This feature works fine if I install it using a complete setup. But when on initial install I chose not to install this feature and then try to install it during a " change " all other custom actions/components inside the feature are executed/installed except for the CopyFile component. This is critical to my setup and if it does not get copied my setup will fail.
Just wondering if anyone found a solution to a similar problem or ever came across a similar issue?
The component which contains the CopyFile operation is configured incorrectly. It should have an actual file or registry entry as a key path.
Although Windows Installer uses components to manage resources, the component key path is main factor which decides if the component is installed or not.
So a component without a resource as a key path will never be installed and the CopyFile operation it contains will never be executed.