[wpkg-users] changing MSI product codes - uninstall problem

Jens Kalinowsky mailinglisten at kalinowsky.de
Sun Jun 27 17:47:22 CEST 2021


Hi!

I have a question about uninstalling MSI packages when the MSI product 
code changes with each version. Until now I thought that wpkg uses the 
remove commands from the local wpkg.xml which are matching to the 
current installed version. But this is apparently wrong.

Let's take the following simple package:

<package id="NextcloudClient"
   name="Nextcloud Client"
   revision="%PKG_VERSION%_%TIMESTAMP%"
   reboot="false"
   priority="30">

   <variable name="PKG_VERSION"     value="3.2.3">
   <variable name="TIMESTAMP"       value="202106271221" />
   <variable name="PKG_SOURCE"      value="%SOFTWARE%\Nextcloud" />
   <variable name="PKG_DESTINATION" value="%PROGRAMFILES%\Nextcloud" />
   <variable name="ARC"             value="x86" architecture="x86" />
   <variable name="ARC"             value="x64" architecture="x64" />
   <variable name="MSI_ProductCode" 
value="{3DCB75AC-5EFF-468E-ACAF-068FCC3912D0}" architecture="x86" /> 
<!-- 3.2.3; previously 3.1.3={0126EB72-EEEA-4518-9ADC-AABF69E2BBA4} -->
   <variable name="MSI_ProductCode" 
value="{E4F354C3-4074-484E-9158-A74D9588652F}" architecture="x64" /> 
<!-- 3.2.3; previously 3.1.3={47699519-0B92-477C-8A38-8914CE77D606} -->

   <check type="uninstall" condition="versiongreaterorequal" 
path="Nextcloud" value="%PKG_VERSION%" />

   <commands>
     <install cmd='taskkill /f /im nextcloud.exe'>
       <exit code='any' />
     </install>
     <command type="install" cmd='msiexec /qn /i 
"%PKG_SOURCE%\Nextcloud-%PKG_VERSION%-%ARC%.msi" /l*vx 
"%temp%\wpkg-NextCloud-%PKG_VERSION%_%random%.log" SKIPAUTOUPDATE=1 
NO_DESKTOP_SHORTCUT=1' />

     <command type="upgrade" include="install" />

     <command type="downgrade" include="remove" />
     <command type="downgrade" include="install" />

     <command type="remove" cmd='msiexec /qn /X%MSI_ProductCode% /l*vx 
"%temp%\wpkg-pkg-remove_NextCloud-%PKG_VERSION%_%random%.log"' />
   </commands>
</package>

Assume that the clients have version 3.2.3 installed. Now we want to 
downgrade to version 3.1.3. So we are changing the PKG_VERSION variable 
to 3.1.3 and actually also setting the MSI product code to that of 
version 3.1.3.

However, the clients with a higher installed version execute the remove 
command of version 3.1.3 when downgrading. But the correct command (with 
the correct MSI product code) would be the one from the local wpkg.xml 
or from the uninstall key in the registry. How do you solve this case?

Should I list all possible product codes in the remove commands? I don't 
think this is very elegant :-( Maybe I'm just overlooking the better way?

Jens



More information about the wpkg-users mailing list