How to uninstall exepackage where separate uninstaller executable to be invoked in wix - wix

I am new to Wix. I have an exe package that installs fine while installing the wix bundle. While uninstalling the bundle exe package uninstall path is setting to the program data cache path but this exe has a different uninstall exe in program files. How can I set it up the uninstall path to the program file path?
<ExePackage Id="exe" DisplayName="name" Name="path\test.exe" SourceFile="path\test.exe" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes" InstallCondition="EXEPRESENT=0" InstallCommand="-y" DetectCondition="EXEPRESENT=1" UninstallCommand="[ProgramFiles64Folder]\path\Uninstall\setup.exe -uninstall"/>
but in the log I am seeing
Applying execute package: EXE, action: Uninstall, path: C:\ProgramData\Package Cache\ECD26B99EA3992A1627A07921292F8C5380F0EB5\Bundle\test.exe, arguments: '"C:\ProgramData\Package Cache\ECD26B99EA3992A1627A07921292F8C5380F0EB5\Bundle\test.exe" C:\Program Files\\path\Uninstall\setup.exe -uninstall'
which is making the exe install again instead of uninstall.

This feature is implemented in WiX v4: https://github.com/wixtoolset/issues/issues/4755

Related

In a WiX Bundle, how can I supply a settings file for an ExePackage?

I am authoring a WiX bundle that installs several other pre-build packages, some are MSIs and some are EXEs.
One of the EXE packages requires a settings file to be supplied which I have to give the path to on the command line.
<ExePackage Id="exePackage"
Description="Executable Installer"
PerMachine="yes"
InstallCommand="-settings=TheConfigurationFile.txt"
SourceFile="RedistributablePackages\TheInstaller.exe" >
How should I package TheConfigurationFile.txt so that the EXE installer can find it? It isn't clear to me how to do that as I can't seem to find any way to specify a file in connection with the ExePackage...?
Check out the Payload element.
<Payload SourceFile="TheConfigurationFile.txt"/>

Pack .EXE in Wix Installer and execute after installation

I'm creating an installer for my application using the wix toolset.
I need to include an .EXE file and execute it during/after the installation process (the .EXE shall not be installed to the application folder).
The .EXE also has a dependency on a .DLL file, which came with the .EXE file.
How can I accomplish this?
Greets
This should work ...
<CustomAction Id ="echo_test"
Directory ="INSTALLLOCATION"
ExeCommand ='NOTEPAD.EXE echo_test.txt'
Execute ="immediate"
Return ="asyncNoWait"
/>
Taken from: Call command line after installation in Wix

VSIX package gets installed by Wix but not uninstalled

I created a Wix installer that installs a VSIX using the VsixPackage extension. The VSIX gets installed properly however two things are bugging me:
The user has the possibility to uninstall the VSIX through the tools / Extensions menu in VS.
When I uninstall the MSI, the VSIX doesn't get uninstalled.
I did set the Permanent attribute of the VsixPackage to no. Here is the markup:
<Component Id="VSIXVS11"
Guid="2C85F474-3E44-4A38-AC2D-0A6F6B1049DA">
<VSExtension:VsixPackage File="MvvmLight.VS2012.vsix"
PackageId="MVVM Light..e8b05c55-a169-42aa-a116-064ef2205f80"
Target="professional"
TargetVersion="11.0"
Vital="yes"
Permanent="no"/>
<File Id="MvvmLight.VS2012.vsix"
Name="MvvmLight.VS2012.vsix"
DiskId="1"
Source="..\..\InstallItems\VSIX\Release\MvvmLight.VS2012.vsix" />
</Component>
Any idea what causes the VSIX to not get uninstalled?
Note: The VSIX's "This VSIX is installed by Windows Installer" flag is not set. If I try to set it, I get an error when running the MSI.
You have a space in the package ID.
Escape the package ID like so:
<VSExtension:VsixPackage File="MvvmLight.VS2012.vsix"
PackageId=""MVVM Light..e8b05c55-a169-42aa-a116-064ef2205f80""
Target="professional"
TargetVersion="11.0"
Vital="yes"
Permanent="no"/>

WiX bootstrapper: Uninstall packages in a chain

<ExePackage Id="PackageID1" DisplayName="xxx" Compressed="yes"
SourceFile="..\xxx\MyExe.exe" Vital="yes"
InstallCommand="parameters to the exe"
UninstallCommand="parameters to the exe"/>
When I trigger the Uninstall action:
this.Engine.Detect();
this.Engine.Plan(LaunchAction.Uninstall);
this.Engine.Apply(System.IntPtr.Zero);
The exePackage does not get invoked. However, during Install, it enters the exe package with the right parameters.
Am I missing something here?
You need a DetectCondition attribute on your ExePackage element. The DetectCondition is how the Burn engine determines if the package is installed on the machine or not. Without a DetectCondition the engine will think the package is never installed so it will never need to be uninstalled. Since all executables are different you have to provide your own DetectCondition. Usually the XxxSearch elements in the util namespace are helpful to detect if your executable is installed.
Note: you can see the 'plan' in the log file and it should show the PackageID1 package being detected as 'Absent' even though it is installed.

Wix bootstrapper uninstall shortcut

I am trying to create shortcuts to uninstalling whatever the bootstrapper has installed.
So simply i want to do the same thing as the uninstall does when going to Add and remove programs.
I found that de bootstrapper is installed in package cache{guid}[bootstrappername].exe
One of the msi packages that it installs also installs a shortcut to this bootstrapper /uninstall call.
However problem is that the GUID of the package is regenerated on every build. So i some how have to set it as
a msi property.
But i cannot figure out how to do this, seem to me that the GUID is not known during building but only after build is done?
is there another way to determine the location of the cached bootstrapper ?
If you are use Managed BA you can try this:
In your Bundle.wxs in chain with MsiPackage add MsiProperty like:
<MsiPackage SourceFile="Setup.msi">
<MsiProperty Name="UNINSTALLER_PATH" Value="[UNINSTALLER_PATH]"/>
</MsiPackage>
Somewhere in code (before call install action), you need set value for this variable like this:
Engine.StringVariables["UNINSTALLER_PATH"] = string.Format(#"{0}\{1}\{2}\{3}.exe", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Package Cache", Engine.StringVariables["WixBundleProviderKey"], ProductName);
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) – path to %systemdir%:\ProgramData
Package Cache- folder name in ProgramData where installing bundle caching
Engine.StringVariables["WixBundleProviderKey"] – name of folder (guid) created by caching bundle
ProductName – name of your bootstrapper “exe”
And finally in your Product.wxs you can create shortcut usual way, but in “Target” attribute you need pass UNINSTALLER_PATH value and “Arguments” set ="/uninstall":
<Shortcut Id="Shortcut1" Name="Uninstall" Description="Uninstall" Target="[UNINSTALLER_PATH]" Arguments="/uninstall" WorkingDirectory="Programmenufolder" />
sorry for my english :)
You can determine the location using the bundle upgradecode you define in your bundle.wxs.
Use the registry path to windows uninstall location of your bundle
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{upgradecode of your bundle}
or for 64 Bit OS
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{upgradecode of your bundle}
The value BundleCachePath contains the fullpath including your bootstrapper.exe filename to the package cache where your bundle is cached.
You can also use the value QuietUninstallString which contains the full quiet uninstall command or UninstallString to launch the uninstall in non quiet mode.