1
votes

I have made a MSI-Package with WiX 3.8, which contains a property for the installfolder called "INSTALLLOCATION". Normally the MSI-package is called by a Bootstrapper-Bundle, which sets the property. In the MSI the property is defined like that:

<Property Id="INSTALLLOCATION"
          Value="ProgramFilesFolder"
          Hidden="no"/>

As You can see, the ProgramFilesFolder is the default value. Now we want - parallel to the Bootstrapper - have the possibility, to install the MSI-package by commandline. So i send the following command:

msiexec /i Setup.msi INSTALLLOCATION=C:\MyApplication

The MSI will be installed in the right place. So far, so good.

But when i try to uninstall it by ControlPanel/Programs or by commandline, it doesn't work, because of the default value "ProgramFilesFolder". Even when i try the follwing command:

msiexec /u Setup.msi INSTALLLOCATION=C:\MyApplication

What can i do, that the uninstall works?

1
Please expand on "it doesn't work". There is no clear reason why not knowing the INSTALLLOCATION would cause the uninstall to fail unless you have some code that depends on it (a custom action?) Windows doesn't need to be told where the files were installed.PhilDW

1 Answers

0
votes

This was my mistake! The RemoveFolder-entry was wrong. When You are using a directory hierarchy like this

<Directory Id="TARGETDIR"
           Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLLOCATION"
               Name="InstallLocation">
      <Directory Id="CompanyFolder"
                 Name="MyCompany">
        <Directory Id="INSTALLDIR"
                   Name="MyApp" />
      </Directory>
    </Directory>
  </Directory>

it has to be:

<RemoveFolder Id="INSTALLDIR"
              On="uninstall"/>

That's all.