4
votes

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 ?

2

2 Answers

1
votes

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

-1
votes

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.