简体   繁体   中英

WIX Uninstall Custom Action Error Code 2753

I'm having problems with a WIX CustomAction that I'd like to run when a user uninstalls an application.

Here's my XML

http://schemas.microsoft.com/wix/2006/wi'>

<Package Description='pak' InstallerVersion='200' Compressed='yes' />

<Media Id='1' Cabinet='setup.cab' EmbedCab='yes' />

<Property Id='ARPSYSTEMCOMPONENT'>1</Property>

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id="TempFolder">
    <Directory Id="INSTALLLOCATION" Name="~_tmpdir">
      <Component Id='MyComponent' DiskId='1' Guid=''>
        <File Id="File0" Name="Runtime.exe" Source="Runtime.exe" />
      </Component>
    </Directory>
  </Directory>
</Directory>


<Feature Id='InstallFeature' Title='Install Feature' Level='1'>
  <ComponentRef Id='MyComponent' />
</Feature>

<CustomAction Id="RunInstall" Return="ignore" Execute="deferred" FileKey="File0" ExeCommand="Runtime.exe" HideTarget="no" Impersonate="no" />
<CustomAction Id="RunUninstall" Return="ignore" Execute="deferred" FileKey="File0" ExeCommand="Runtime.exe" HideTarget="no" Impersonate="no" />

<InstallExecuteSequence>
  <Custom Action="RunInstall" Before="InstallFinalize">NOT REMOVE~="ALL"</Custom>
  <Custom Action="RunUninstall" Before="InstallFinalize">REMOVE~="ALL"</Custom>
</InstallExecuteSequence>

The Runtime.exe launches as expected when installing the application but when I uninstall I get an error "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2753".

Looking at the event viewer sheds a little more light on the problem, it contains the following "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2753. The arguments are: File0, , ".

So, it seems like it can't find Runtime.exe but I'm not sure why. The file is bundled into the MSI and it runs on install but I can't work out why it doesn't run on uninstall.

Many thanks

You should sequence the uninstall custom action earlier. "Before InstallFinalize" is very late, and almost certainly results in attempting to run the program after RemoveFiles has deleted it, hence the error. Look at the InstallExecuteSequence in your MSI file and see where RemoveFiles is relative to your CA and InstallFinalize. You may need to be before StopServices and other actions that remove registry values, depending on how much of the installed product your code needs. Or run it from the Binary table (beware of dependencies) if it really needs to be literally just before the uninstall completes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM