Installing driver using cutomAction DriverPackageI

2019-07-20 02:51发布

I have a driver installing using DriverPackageInstall, and uninstall DriverPackageUnInstall in wix installer. It works very well, If install and Uninstall driver version 1.0.0.0.

But when I install 1.0.0.0 and upgrade 1.2.0.0. it works well replaces drivers with 1.2.0.0 binaries.

But when I uninstall, driver is not uninstalled, checked logs found that uninstallation successful DriverPackageUnInstall return 0, also logContext.difxError is also 0.

Not able to figure why driver is not being uninstalled.

 <Custom Action='InstallDriverAction'
         After='InstallFiles'>NOT Installed</Custom>

 <Custom Action='UninstallDriverAction'
         After='InstallInitialize'>
                Installed AND NOT UPGRADINGPRODUCTCODE</Custom>

One observation is driver,cat,inf of version 1.0.0.0 is still present at DRVSTORE, and driver with 1.2.0.0 deleted.

Any help will appreciated.

Thanks

标签: wix
1条回答
SAY GOODBYE
2楼-- · 2019-07-20 03:31
 <Custom Action='UninstallDriverAction'
         After='InstallInitialize'>
                Installed AND NOT UPGRADINGPRODUCTCODE</Custom>

The condition looks wrong. It currently says "uninstall the driver if it is installed, except during a major upgrade". You propably want to uninstall the old version of the driver during major upgrade, so the AND NOT UPGRADINGPRODUCTCODE should be removed.

The Installed part of the condition is also wrong. Actually this would uninstall the driver when doing a repair! It could be argued that it can be useful to uninstall the driver and then install it again to hopefully fix some errors. But in its current state, the driver would not be installed again during a repair, because the properties are checked only once at the acquisition phase and won't be updated during the execute phase of the setup.

My suggestion:

 <Custom Action='InstallDriverAction'
         After='InstallFiles'>NOT Installed OR REINSTALL</Custom>

 <Custom Action='UninstallDriverAction'
         After='InstallInitialize'>
                REMOVE~="ALL" OR REINSTALL</Custom>

The first condition is pretty standard: install the driver if it is not already installed OR this is a reinstall (aka repair).

The second condition says to uninstall the driver in any of these cases:

  • During a regular uninstall
  • During an uninstall in the context of a major upgrade. This requires early sequencing for the RemoveExistingProducts standard action so the uninstall of the existing version will be done entirely before installing the new version. When using the WiX MajorUpgrade element the default is Schedule="afterInstallValidate", which does exactly that.
  • During a reinstall (aka repair). I'm not entirely sure yet if that's a good idea, see comments below.
查看更多
登录 后发表回答