我需要将DLL复制到system32
文件夹中,这是我的WIX脚本,但它不起作用,复制命令失败了:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="LMBrick Service" Language="1033" Version="1.3.0.0"
Manufacturer="MyCompany" UpgradeCode="3de1a175-3701-435f-90bc-e97cb66b5524">
<Package InstallerVersion="200" Compressed="yes" InstallPrivileges="elevated" AdminImage="yes" InstallScope="perMachine" Platform="x64" />
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Feature Id="ProductFeature" Title="LMBrickServiceInstallation" Level="1">
<ComponentGroupRef Id="LMBrickComponents" />
</Feature>
<CustomAction Id="InstallLMBrickDll" Directory="LMBRICKINSTALLFOLDER" Execute="deferred" Impersonate="no"
ExeCommand="copy LMBrick.dll [System64Folder]LMBrick.dll"
Return="check" />
<InstallExecuteSequence>
<Custom Action="InstallLMBrickDll" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="Company" Name="MyCompany">
<Directory Id="App" Name="MyProduct">
<Directory Id="LMBRICKINSTALLFOLDER" Name="LMBrickService">
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
答案 0 :(得分:3)
运行Exes的自定义操作必须实际运行exe。但复制不是exe;它内置在命令shell中。所以你有两个直接的选择(以后两个更好的选择):
您可以通过打开命令提示符并分别执行命令复制和其中xcopy 来确认这一点。请注意,将cmd.exe或任何控制台程序作为Exe启动将导致控制台窗口在安装期间闪烁。这通常看起来很不专业,您应该使用以下两种方法之一:
如果可能,最好避免自定义操作并使用Windows Installer功能。因此,如果可以,请瞄准最后一个选项。