4

我在运行时使用 Heat 来生成将要安装的组件。我需要复制的文件很少。但是每次我<CopyFile>在没有 FileId 属性的情况下使用时,它都会在运行时失败Error 2716: Couldn't create a random subcomponent name for component 'copyFile'

我不能使用 FileId 因为它在设计时是未知的。

4

2 回答 2

0

您可以使用 XSL 模板转换输出 WXS 文件。-t:可以在 heat 命令行选项之间切换来执行此操作。在该模板中,您可以将CopyFile元素添加到适当的组件中,并避免您面临的“Id 未知”问题。

于 2011-08-25T08:18:51.253 回答
-2

使用石蜡或自定义操作

  • 石蜡

%1\Paraffin.exe -dir "..\..\AppFolder" -dirref INSTALLLOC -custom COMPONENTNAME ..\..\ApplicationFragment.wxs -guids -ext .csproj -ext .cs -direXclude obj -direXclude "bin\Config" -direXclude Properties -multiple

  • 自定义操作

在自定义操作中添加

<CustomAction Id="A_SetQtCmdLineCopyFiles" Property="QtExecCmdLine"
                Value="&quot;[SystemFolder]cmd.exe&quot; /c copy &quot;[INSTALLLOC]AppFolder\FileName&quot; &quot;[TARGETDIR]&quot;" />
<CustomAction Id="QtCmdCopyFiles" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore" />

然后在 Product.wxs 添加

<Custom Action="GA_SetQtCmdLineCopyFiles" After="InstallFinalize">NOT INSTALLED AND NOT REMOVE</Custom>
<Custom Action="QtCmdCopyFiles" After="GA_SetQtCmdLineCopyFiles">NOT INSTALLED AND NOT REMOVE</Custom>
于 2011-08-24T17:18:28.893 回答