【发布时间】:2015-06-24 10:02:09
【问题描述】:
我在使用 WIX 制作的 .MSI 包中执行 VBscript 时遇到了一点问题。尝试构建项目时会引发 2 个错误:
未找到 CustomAction 元素的 DllEntry、Error、ExeCommand、JScriptCall、Script、Value 或 VBScriptCall 属性;其中之一是必需的。
和
CustomAction 元素包含非法的内部文本:'Directory="INSTALLFOLDER"
我不完全理解它为什么会抛出这些错误。
我确实给了它INSTALLFOLDER 作为目录,因为这是 VBscript 所在的位置,第二个错误我不知道,因为我不完全了解如何格式化 ExeCommand。
这是我使用的代码:
<Feature Id="ProductFeature" Title="wix_script_execution" Level="1">
<ComponentGroupRef Id="script"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="wix_script_execution" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="script" Directory="INSTALLFOLDER">
<Component Id="InstallationScript" Guid="{AFA49EED-4F2C-42B4-B7EC-D3B7896C970C}">
<File Id="InstallationScript" KeyPath="yes" Source="C:\Users\fjansen\Documents\Visual Studio 2013\Projects\Wix test\Installation script\obj\Debug\Installation script.exe" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<CustomAction Id="RunInstallScript">
Directory="INSTALLFOLDER"
ExeCommand="[INSTALLFOLDER]Installation script.exe"
Execute="commit"
Return="ignore"/>
</CustomAction>
<InstallExecuteSequence>
<Custom Action="RunInstallScript" Before="InstallFinalize" />
</InstallExecuteSequence>
</Fragment>
其中包含自定义操作的片段是从互联网上复制并由我修改的,但显然方式不正确。
最终目标是在所有文件复制到目标位置后,此 VBscript 会自动运行。
VBscript只需执行一次,无需安装。
2015 年 7 月 7 日添加:
我终于能够测试建议的信息。但是它仍然没有执行文件,编译项目时我没有收到任何错误,因此我不清楚原因是什么。
这是我与其中包含的建议一起使用的代码:
<Fragment>
<CustomAction Id="RunInstallScript"
Directory="INSTALLFOLDER"
ExeCommand="[INSTALLFOLDER]Installation script.exe"
Execute="commit"
Return="ignore"
/>
<InstallExecuteSequence>
<Custom Action="RunInstallScript" Before="InstallFinalize" />
</InstallExecuteSequence>
</Fragment>
我认为问题与 ExeCommand 有关,因为它只是不执行脚本。芽我就是不能让它工作,我错过了什么?
提前致谢。
【问题讨论】: