繁体   English   中英

安装过程中的Wix自定义操作失败

[英]Wix Custom Action during installation failing

我试图在安装过程中(复制文件之后)使用自定义操作来运行带有命令行选项的程序。 该操作需要管理员权限(它可以设置和安装Windows服务)。 由于某些原因,自定义操作一直失败。

我的wix代码:

<?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>

这是我在msi日志中遇到的错误:

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 

如果我以普通用户身份运行命令行,它将失败,但是如果以管理员用户(或系统用户)身份运行,它将起作用。 我相当确定问题出在操作权限上。 我已将其设置为deferr并且Impersonate ='no',但仍然无法正常工作。 有人有提示吗?

编辑:所以,我发现在launchapplication中的快捷方式显然不适用于可执行文件的路径。 有谁知道允许这样做的语法?

最终自己弄清楚了。

改变了

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

线到

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

希望这对将来的其他人有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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