简体   繁体   中英

Wix Custom Action during installation failing

I'm attempting to use a custom action to run a program with a command-line option during installation (after files copied). The action requires admin permission (it sets up and installs a windows service). For some reason, the custom action keeps failing.

My wix code:

<?xml version='1.0' encoding='Windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Name='WHS 2011 Media Collector'
Id='28656223-C2E0-4E74-8503-B9D668056C4E'
UpgradeCode='84F31832-4E09-4149-A3F7-56A8DF63086F'
Language='1033'
Codepage='1252'
Version='3.0.0'
Manufacturer='Nick Radtke'>

<Package
  Id='*'
  Keywords='Installer'
  Platform="x64"
  Description="WHS 2011 Media Collector" Comments='Deployment Package for WHS 2011 Media Collector'
  Manufacturer='Nick Radtke'
  InstallerVersion='300'
  Languages='1033'
  Compressed='yes'
  SummaryCodepage='1252'
  InstallPrivileges='elevated'
  InstallScope='perMachine'/>

<Media
  Id='1'
  Cabinet='WSSSampleAddins.cab'
  EmbedCab='yes'
  DiskPrompt="CD-ROM #1" />

<Property Id='DiskPrompt' Value="Addins Installation [1]" />
<Property Id="LaunchApplication" Value="&quot;MediaCollectorServerService.exe&quot; -install"/>
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

<InstallExecuteSequence>
  <Custom Action='LaunchApplication' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>


<CustomAction Id="LaunchApplication"
                                BinaryKey="WixCA"
                                Impersonate="no"
              DllEntry="CAQuietExec64"
              Execute="deferred"
              Return="check"
              />

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id='ProgramFiles64Folder' Name='PFiles'>
    <Directory Id="ParentAddinBinaryDir" Name="Nick Radtke">
      <Directory Id="AddinBinaryDir" Name="WHS 2011 Media Collector">
        <Component
          Id='WHS2011MCBinaryComponent'
          Guid='D21DA776-83F1-4F22-985B-FDB3C8ABD481'
          Win64='yes'>
          <RemoveFolder Id='AddinBinaryDir' On='uninstall' />
          <File
            Id='WHS2011MediaCollector.ListViewSubTab'
            Name='WHS2011MediaCollector.ListViewSubTab.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.ListViewSubTab.dll'
            ProcessorArchitecture='x64'
            KeyPath='yes'>
          </File>
          <File
            Id='WHS2011MediaCollector.TopLevelTab'
            Name='WHS2011MediaCollector.TopLevelTab.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.TopLevelTab.dll'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='WHS2011MediaCollector.PicturesSubTab'
            Name='WHS2011MediaCollector.PicturesSubTab.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.PicturesSubTab.dll'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='WHS2011MediaCollector.VideosSubTab'
            Name='WHS2011MediaCollector.VideosSubTab.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.VideosSubTab.dll'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='WHS2011MediaCollector.SettingsSubTab'
            Name='WHS2011MediaCollector.SettingsSubTab.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.SettingsSubTab.dll'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='NetLibrary'
            Name='NetLibrary.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\NetLibrary.dll'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='Icon.png'
            Name='Icon.png'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\Icon.png'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='taglib_sharp'
            Name='taglib-sharp.dll'
            DiskId='1'
            Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\taglib-sharp.dll'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
          <File
            Id='MediaCollectorServerService.exe'
            Name='MediaCollectorServerService.exe'
            DiskId='1'
            Source='..\..\MediaCollectorServerService\x64\Release\MediaCollectorServerService.exe'
            ProcessorArchitecture='x64'
            KeyPath='no'>
          </File>
        </Component>
      </Directory>
    </Directory>

    <Directory Id="WindowsServerDir" Name="Windows Server">
      <Directory Id="WindowsServerBinDir" Name="Bin">
        <Directory Id="WindowsServerAddinsDir" Name="Addins">
          <Directory Id="WindowsServerPrimaryDir" Name="Primary">
            <Component
              Id='WHS2011MCXMLComponent'
              Guid='D21DA776-83F1-4F22-985B-FDB3C8ABD491'
              Win64='yes'>
              <File Id='WHS2011MCTopLevelTabXML'
                Name='WHS2011MediaCollector.addin'
                DiskId='1'
                Source='..\..\MediaCollectorAddIn\MediaCollector\TopLevelTab\bin\Release\WHS2011MediaCollector.addin'
                ProcessorArchitecture='x64'
                KeyPath='yes'>
              </File>
            </Component>
          </Directory>
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Directory>

<Feature Id='Complete' Level='1'>
  <ComponentRef Id='WHS2011MCBinaryComponent' />
  <ComponentRef Id='WHS2011MCXMLComponent' />
</Feature>
</Product>
</Wix>

This is the error I'm getting in the msi log:

MSI (s) (40:30) [22:58:07:647]: Created Custom Action Server with PID 11672 (0x2D98).
MSI (s) (40:40) [22:58:07:663]: Running as a service.
MSI (s) (40:40) [22:58:07:663]: Hello, I'm your 32bit Elevated custom action server.
CAQuietExec64:  Error 0x80070002: Command failed to execute.
CAQuietExec64:  Error 0x80070002: CAQuietExec64 Failed
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 22:58:07: InstallFinalize. Return value 3.
MSI (s) (40:D0) [22:58:07:694]: Note: 1: 2265 2:  3: -2147287035 

If I run the command line as a normal user, it fails, but if I run it as an admin user (or the system user), it works. I'm fairly certain the problem is the permissions on the action. I've set it to deferred and Impersonate='no', but it's still not working. Anyone have any tips?

Edit: So, I've found that apparently shortcuts in launchapplication aren't working for the path of the executable. Does anyone know the syntax that allows for this?

Ended up figuring it out myself.

Changed the

<Property Id="LaunchApplication" Value="&quot;MediaCollectorServerService.exe&quot; -install"/>

line to

<SetProperty Id="LaunchApplication" Before="InstallInitialize" Sequence="execute" Value="&quot;[#MediaCollectorServerService.exe]%quot; -install"><![CDATA[NOT Installed AND LaunchApplication=""]]</SetProperty>

Hoping this proves useful for others in the future.

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