WiX静默执行.cmd文件

时间:2018-12-17 12:10:09

标签: wix windows-installer custom-action

使用WixQuietExec时,我尝试启动的命令行文件似乎在安装过程中未运行。

我这样做的原因是,我正在构建的安装程序必须按特定顺序运行许多.exe / .bat文件才能正确构建。

.wxs文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="immediateExecution" Language="1033" Version="1.0.0.0" Manufacturer="test" UpgradeCode="8b6b82f7-ecbb-426d-bd9a-6fb7548ac349">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="immediateExecution" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="immediateExecution" />
        </Directory>
    </Directory>
</Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">

    </ComponentGroup>
    <Property Id="WixQuietExecCmdLine" Value="blankfile.cmd"/>
    <CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="check"/>

    <InstallExecuteSequence>
       <Custom Action="QtExecExample" Sequence="1"/>
    </InstallExecuteSequence>

  </Fragment>
</Wix>

blankfile.cmd

cd C:\Users\ljn\Desktop
copy NUL EMptyFile.txt

这显然是一个测试用例,用于检查可以在WiX中实现的功能。从文档看来,这应该很容易实现,但是此处的示例并未产生预期的结果。 .wxs文件有问题吗?请记住,在VS中已正确添加了utils参考。

0 个答案:

没有答案